diff --git a/engine/examplefuncsplayer/bot.py b/engine/examplefuncsplayer/bot.py index c2592f3..9a8d873 100644 --- a/engine/examplefuncsplayer/bot.py +++ b/engine/examplefuncsplayer/bot.py @@ -1,4 +1,3 @@ -import random from malthusia.stubs import * @@ -10,6 +9,7 @@ def dlog(str): if DEBUG > 0: log(str) +i = 0 def check_space_wrapper(r, c, board_size): # check space, except doesn't hit you with game errors @@ -66,9 +66,10 @@ def turn(): index = board_size - 1 for _ in range(board_size): - i = random.randint(0, board_size - 1) + global i if not check_space(index, i): spawn(index, i) + i += 1 dlog('Spawned unit at: (' + str(index) + ', ' + str(i) + ')') break diff --git a/engine/malthusia/engine/game/game.py b/engine/malthusia/engine/game/game.py index 5884e57..6ebd166 100644 --- a/engine/malthusia/engine/game/game.py +++ b/engine/malthusia/engine/game/game.py @@ -251,6 +251,9 @@ def spawn(self, robot, row, col): Only the HQ can spawn units, and it can only spawn one unit per turn. :loc should be given as a tuple (row, col), the space to spawn on """ + if type(row) != type(1) or type(col) != type(1) or type(robot) != type(Robot(0,0,0,0)): + raise RobotError("types are incorrect") + if robot.has_moved: raise RobotError('you have already spawned a unit this turn')