/ants/dist/starter_bots/common_lisp/README.md

https://github.com/pedrosorio/aichallenge · Markdown · 81 lines · 54 code · 27 blank · 0 comment · 0 complexity · 4159adf224b51fb067f158e4fa5d958d MD5 · raw file

  1. # Common Lisp Starter Package for Ant Wars
  2. This is the basic CL starter package, a more extensive starter package
  3. with [proxy-bot](http://ai-contest.com/forum/viewtopic.php?f=19&t=468)
  4. functionality can be found at [http://github.com/aerique/google-ai-challenge-2011-1-ants/tree/master/common-lisp-starter-package](http://github.com/aerique/google-ai-challenge-2011-1-ants/tree/master/common-lisp-starter-package).
  5. This rest of this file contains specific information about the Common
  6. Lisp starter package for the [Ant Wars Google AI Challenge](http://ai-contest.com/).
  7. It is assumed you are using [SBCL](http://www.sbcl.org/), since that
  8. is what the challenge server will be using as well. Feel free to try
  9. any CL implementation locally but do realize SBCL is used on the
  10. official tournament server.
  11. ## Usage
  12. To compile the source files into a `MyBot` binary issue "`sbcl --script
  13. MyBot.lisp`". To test your bot locally you'll need to get the AI
  14. Challenge source tree:
  15. git clone git://github.com/aichallenge/aichallenge.git
  16. Go to the `aichallenge/ants` directory and do:
  17. ./playgame.py --end_wait=0.25 --verbose --log_dir game_logs --turns 100 --map_file maps/symmetric_maps/symmetric_10.map "python dist/sample_bots/python/HunterBot.py" "python dist/sample_bots/python/LeftyBot.py" "python dist/sample_bots/python/HunterBot.py" /path/to/your/MyBot
  18. To upload a submission you only need to zip all the lisp-files: "`zip
  19. submission.zip *.lisp`". ("`make submission-zip`" will do the same).
  20. ### Submission Errors
  21. If SBCL does any output on standard error (stderr / \*error-output*)
  22. it will count as a compilation error to the server. So even innocuous
  23. compiler notes or warnings will cause a compilation error.
  24. I've added two statements to MyBot.lisp that should muffle most of the
  25. warnings, but I'm not sure they will catch them all. If really
  26. necessary redirect \*error-output* to \*standard-output* like so:
  27. `(setf *error-output* *standard-output*)` at the top of MyBot.lisp.
  28. **However**, this will also hide genuine compilation errors that would
  29. otherwise be shown on your profile page! So if your bot still fails
  30. compiling on the server, your best best is resubmitting with the
  31. redirection disabled.
  32. ### Windows / MSYS Note
  33. You're probably best of putting a symbolic link `sbcl` in /usr/bin
  34. pointing to wherever SBCL is installed on your system.
  35. It is assumed you are running [MSYS](http://www.mingw.org/node/18).
  36. ## Source
  37. `MyBot.lisp` is needed for compilation on the official server.
  38. `main.lisp` contains the main loop and the DO-TURN function, this is
  39. were the starter bot's simple AI resides.
  40. `ants.lisp` contains all other helper functions.
  41. ### Internal Map Representation
  42. The map is internally represented as a 2-dimensional array of [fixnums](file:///export/home/ekwis/emacs/HyperSpec/Body/t_fixnum.htm#fixnum)
  43. and is accessible as `(game-map *state*)`. Do note that it is reset and
  44. modified when PARSE-GAME-STATE is called during the main loop, so work
  45. on a copy if you have to.
  46. Each tile of the map can be accessed by `(aref (game-map *state) row col)`
  47. and the values of the tiles have to following meaning:
  48. 0 = land
  49. 1 = water
  50. 2 = food
  51. 100+ = live ant
  52. 200+ = dead ant
  53. Your live ants are always represented as 100 and your dead ants as
  54. 200.