Programming
Workshop

Spring 2010
course
navigation

mar 9

after break thinking

tourney

Below are the tourney results, which we'll discuss in class, along with some visual inspection of matches and code perusal.
A "nullwin" means that your bot won because the other bot made an illegal (i.e. not 1,2,3,4) move.
A "nullloss" means that your bot issued an illegal move ... which means you have debuggging to do, eh?
The attached "details.txt" gives a detailed account of three rounds, six submitted bots. The breakdown by room is *not* equal; my guess is that not everyone has tested in all rooms and/or starting configurations.
Marlboro Tron Tournament 1 ; March 9 2010, 1am Six contestants 6*5/2 = 15 pairings per map, each bot plays other 5*2 = 10 times (both starting spots) Seven maps (empty-room, huge-room, toronto, u, trix, quadrant, ring) 7*15 = 119 games per round, each bot does 7*10 = 70 per round Try this in class : $ tourney -v -v -v --rounds=1 tourney1/botlist.txt tourney1/maplist.txt == 1st try == one round $ tourney -v --rounds=1 tourney1/botlist.txt tourney1/maplist.txt name wins losses draws nullwins nulllosses sam 52 12 6 22 0 devin 39 11 11 19 9 elias 34 29 7 22 0 ian 30 4 9 13 27 aaron 29 30 11 22 0 peter 4 0 0 4 66 == 2nd try == same command; modified peter's code to avoid error printout name wins losses draws nullwins nulllosses sam 51 13 6 22 0 devin 38 12 11 19 9 elias 34 29 7 22 0 ian 32 5 6 13 27 aaron 31 29 10 22 0 peter 4 0 0 4 66 == 3rd try == three rounds, more verbosity; details.txt saved. $ time tourney -v -v --rounds=3 tourney1/botlist.txt tourney1/maplist.txt name wins losses draws nullwins nulllosses sam 155 37 18 66 0 devin 112 37 34 57 27 elias 102 87 21 66 0 ian 94 12 23 39 81 aaron 90 86 34 66 0 peter 12 0 0 12 198 real 7m37.097s user 2m14.285s sys 0m29.094s ====================================================================== with the random bot in the mix : name wins losses draws nullwins nulllosses sam 62 15 6 22 1 devin 48 14 11 19 11 aaron 44 28 12 22 0 elias 40 31 13 23 0 ian 37 7 7 13 33 random 30 45 9 22 0 peter 4 0 0 4 80 in the small and large empty room only : name wins losses draws nullwins nulllosses ian 38 1 9 12 0 sam 35 10 3 12 0 elias 27 18 3 12 0 random 18 27 3 12 0 aaron 17 24 7 12 0 devin 17 6 3 6 22 peter 2 0 0 2 46

in class

#!/usr/bin/python """ Demo of remembering something. And not going into tunnels. """ import random, tron, utilities class Bot: """ A really short python class. """ pass bot = Bot() bot.moves = 0 bot.direction = tron.NORTH debug = utilities.LogFile("mar9") def isDeadEnd(board, position, direction): """ Return True if there's a tunnel in that direction from that position. """ positionAhead = board.rel(direction, position) for place in board.adjacent(positionAhead): if board.passable(place): return False return True def which_move(board): bot.moves += 1 debug.log("move " + str(bot.moves) + ":") if isDeadEnd(board, board.me(), tron.NORTH): debug.log(" TUNNELL to NORTH!!") bot.direction = tron.WEST debug.log(" going " + str(bot.direction)) return bot.direction # make a move each turn for board in tron.Board.generate(): tron.move(which_move(board)) # ## Jim says: this is some code from Aaron that motivated thinking about this : # # if board[me[0]+1, me[1]+1]] == tron.WALL and board[me[0]+1, me[1]-1]] == tron.WALL and board[me[0]+2, me[1]] == tron.WALL: # return random.choice(board.moves())
http://cs.marlboro.edu/ courses/ spring2010/programming/ notes/ mar_9
last modified Tuesday March 9 2010 2:53 pm EST

attachments [paper clip]

     name last modified size
[TXT]botlist.txt Mar 9 2010 1:40 am 272B [TXT]details.txt Mar 9 2010 1:40 am 12.9kB [TXT]maplist.txt Mar 9 2010 1:40 am 215B