-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
One can estimate the number of total pawns on its team by using the id() function.
import random
a = []
def turn():
global a
a = [random.random() for i in range(999)]
log(str(id(a[-1])))
board_size = get_board_size()
team = get_team()
opp_team = Team.WHITE if team == Team.BLACK else team.BLACK
robottype = get_type()
if robottype == RobotType.OVERLORD:
if team == Team.WHITE:
index = 0
else:
index = board_size - 1
for i in range(board_size):
if not check_space(index, i):
spawn(index, i)
break
else:
passWhat's happening is that 999 new objects are created each time the turn function is run. This causes the id's to increase over time, and so by comparing the id's from last turn to the most recent turn, the robot can estimate the number of robots on its team.