This project provides a command-line-interface (CLI) or a html interface (WEB).
The Pixel Art was created by https://www.fiverr.com/pixelquato
You can either access the web version at https://oglimmer.github.io/karel-robot-js/ or run it yourself:
docker run --rm -it -v $(pwd)/src:/usr/share/nginx/html:ro -p 8080:80 nginx
You need to have nodejs installed. I've tested it with Nodejs V18.
npm ci
echo '
repeat until not house
if is random
turnleft
end, else
move
end
end
'|node src/cli.js
you can also create a text file (code.txt) and put the commands into it, then run it via:
cat code.txt | node src/cli.js
you can also change the delay between 2 steps and the initial board configuration:
cat code.txt | node src/cli.js --field '{"walls":[[3,3],[3,4],[3,5]],"packages":[[7,7,2]],"home":[9,9],"meeple":[9,0]}' --d 100
The syntax consists of commands and blocks.
A block is one or more commands
learn leftelserandom
if is random
turnleft
end, else
move
end
end
repeat until not house
leftelserandom
end
repeat 4-times
if not east
move
log "move east"
end
end
say "we have done it!"