feb 23
progress reports
Project pages :
As of 10pm last night, I don't see
any new code on these ... including
the "add Jim" or "add README/LICENSE" I asked for last week.
Discuss what's to be done.
OK, specific assignment, I guess :
- Create a "follow right hand wall" bot. Test with a maze, with wall between bots. Does this algorithm solve any maze?
- Create a "kamikazee" bot.
###############################
# 1 # # #
# # # #
# #### # #### # ###### #
# # # # # # #
# # # # # # #
# ########## #### # # ####
# # # # # # #
# # # # # # #
### # #### # ####### # #
# # # # #
# # # # #
# ####### # ####### #######
# # # #
# # # ~ #
###############################
discuss min/max algorithm
Analyze what exactly happens in a tiny box, say
#####
#1 #
# #
# 2#
#####
Implementation?
inClassBot.py
import tron
import random
log = tron.LogFile("inClassBotLog.txt")
def which_move(board):
them = board.them()
me = board.me()
if me[0] > them[0]:
move = tron.NORTH
elif me[0] < them[0]:
move = tron.SOUTH
elif me[1] > them[1]:
move = tron.WEST
else:
move = tron.EAST
log.log("moving " + str(move))
return move
# you do not need to modify this part
for board in tron.Board.generate():
tron.move(which_move(board))
recursion example
def fib(n):
print " ... working on " + str(n)
if n < 2:
return 1
else:
return fib(n-1) + fib(n-2)
print "the answer is " + str(fib(10))