Example #1
0
 def readBoard(self):
     b = C.getBoard(self.token)
     # can be empty if nothing has changed
     # leave the previous board
     self.bchanged = b != None
     if b: self.b = b
Example #2
0
    return token


def chooseCommand(b):
    commands = b['board']['you']['commands']
    if len(commands) == 0: return None
    i = random.randrange(0, len(commands))
    return commands[i]['command']


if __name__ == '__main__':
    random.seed()
    try:
        C.registerAutom()
        tokenp = registerNewGame()
        print(tokenp)
        tokena = joinGame()
        print(tokena)
        b = C.getBoard(tokenp)
        print(b)
        y = b['board']['you']
        print(y)
        co = y['commands']
        print(co)
        comm = chooseCommand(b)
        print(comm)
        item = C.itemizeCommand(tokena, comm)
        print(item)
    except Exception as e:
        print(e)