mirror of
https://github.com/swarm-game/swarm.git
synced 2024-10-27 01:49:15 +03:00
5a01658883
Closes #696.
14 lines
356 B
Plaintext
14 lines
356 B
Plaintext
def ifC : forall a. cmd bool -> {cmd a} -> {cmd a} -> cmd a =
|
|
\test. \thn. \els. b <- test; if b thn els end
|
|
|
|
// Recursive DFS to harvest a contiguous forest
|
|
def dfs : cmd unit =
|
|
ifC (ishere "tree") {
|
|
grab;
|
|
turn west;
|
|
ifC blocked {} {move; dfs; turn east; move};
|
|
turn north;
|
|
ifC blocked {} {move; dfs; turn south; move};
|
|
} {}
|
|
end
|