-
Couldn't load subscription status.
- Fork 61
Frequently Asked Questions, Tips and Tricks
If you only see basic colors on the map, you probably have the TERM environment variable set to the default xterm:
echo $TERM # prints "xterm"Swarm uses 8-bit colors, so you need to set:
export TERM=xterm-256color
# or to set the env variable at future shell starts
echo 'export TERM=xterm-256color' >> ~/.bashrcThis setting improves the output of many terminal applications, so you likely have this set already. 😉
You may also want to try a different terminal application for playing Swarm. See Terminal settings for recommendations.
If you try to directly use a cmd bool (such as blocked) in an if, it doesn't work: you'll get an error like Can't unify bool and cmd bool. You have to first bind the output of the cmd bool to a variable, then test that, like so:
b <- blocked;
if b { turn back } { move }
If you find yourself doing this a lot, you can even make a custom version of if which takes a cmd bool instead of a bool:
def ifC : cmd bool -> cmd a -> cmd a -> cmd a
= \test. \then. \else.
b <- test;
if b then else
end
Now you can write
ifC blocked { turn back } { move }
No good reason, this is a known issue and will be fixed at some point! For now, you simply have to run "somefile.sw" first, then run f as a separate REPL input.