Programming
Workshop

Spring 2014
course
navigation

finish words - Feb 4

Discuss your homework : github, anagrams, and palindromes
See the code at:
Or maybe you'll like this :
Getting set up with github:
Things to consider (or reconsider):

tron

Start talking about the Tron robot challenge.
The original materials, explanations, and "starter packages" are at
I've uploaded an engine that runs the bots to github which is also on csmarlboro in the /var/www/csmarlboro/tron folder
Here's how you can copy the files to your folder and run it on csmarlboro :
laptop$ ssh user@csmarlboro.org # where user=your_username csmarl$ scp -r /var/www/csmarlboro/tron . # copy the tron folder to here. csmarl$ cd tron # go into that new folder csmarl$ ./run # run two bots against each other
Or you can clone or download the github repo.
I'll walk through how the thing works, and describe the python robot examples.
Essentially :
Running a robot manually, for example, could look like this:
$ ./MyTronBot.py | You type the stuff on the left. 5 4 < It reads: width height of board ##### < north wall #1 2# < 1 is bot; 2 is opponent # # < ##### < south wall 2 > It writes this: move 1 east 5 4 < Then it reads the next board; ##### < same format. Walls appear ##1## < where the bots were. # 2# < ##### < 3 > It writes the only legal move: south
and so on. The bots move simultaneously. If both move to the same spot, it's a draw. If your bot makes an illegal move, or takes too long (about a second), you forfeit the game. If you do make a legal move but they don't (if they are boxed in, for example) then you win.
The tron.py package can handle the input/output for you, and gives you an API for finding out what's where on the board. You'll need to read the source and/or look at the bots for examples to see how it works.
There are several engines (including a tournament engine which runs a bunch of players in a bunch of rooms), and one that saves a game file that can be replayed through a web browser.

If you want to use their Java engine (included in the starter packages):
1. Download and unpack (doubleclick or "unzip" from the command line) the starter package, e.g. http://tron.aichallenge.org/starter_packages/python_starter_package.zip
2. From the command line
$ cd python # the python starter package $ ls COPYING engine/ freebot.py* northbot.py* tron.py MyTronBot.py* example_bots/ maps/ randbot.py* wallbot.py* $ java -jar engine/Tron.jar maps/empty.txt ./MyTronBot.py ./MyTronBot.py
That should run (in glorious ascii art) those two bots in that room, on the terminal.
The python bot uses the definitions in the tron.py file to do the tricky stuff.
To write your own first robot, look at wallbot.py, northbot.py, and randbot.py, and adapt according to your own thinking ...
Things to think about:
http://cs.marlboro.edu/ courses/ spring2014/workshop/ notes/ finish_words
last modified Sunday February 9 2014 4:13 pm EST