Skip to content

Commit

Permalink
Add Baklava in Opa (#4401)
Browse files Browse the repository at this point in the history
* Add Baklava in Opa

* Forgot to add Opa file
  • Loading branch information
rzuckerm authored Jan 22, 2025
1 parent e1c0d3b commit ccdc4ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions archive/o/opa/baklava.opa
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function page() {
<pre>{baklava()}</pre>
}

function baklava() {
recursive function baklava_rec(lines, n) {
if (n > 0) lines + baklava_line(n) + baklava_rec(lines, n - 1) else lines + baklava_line(n)
}

baklava_rec("", 20)
}

function baklava_line(n) {
num_spaces = Int.abs(n - 10)
num_stars = 21 - 2 * num_spaces
String.repeat(num_spaces, " ") + String.repeat(num_stars, "*") + "\n"
}

Server.start(
Server.http,
{ title: "Baklava", page: page}
)
2 changes: 1 addition & 1 deletion archive/o/opa/testinfo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ folder:

container:
image: "rzuckerm/opa"
tag: "1.1.1-2"
tag: "1.1.1-3"
build: "opa {{ source.name }}{{ source.extension }}"
cmd: "run_opa {{ source.name }}.js"

0 comments on commit ccdc4ea

Please sign in to comment.