Example #1
0
 def test6(self):
     print("Advance Culture and put great person on board now")
     G = TestHelper.DeployTestGame("test1", "game-55.json", "America")
     PA = G.playA()
     PA.readBoard()
     PA.playSingleCommand(CO.Command.GREATPERSONPUTNOW,lambda x : misc.eqP({"row" : 2, "col" : 2}, x['p']),
                                               lambda b : misc.eqP({"row" : 1, "col" : 1}, b['p']) and b['greatperson'] == "LouisPasteur")
     PA.readBoard()
     s = getSquare(PA, 1,1)
     print(s)
     print("Scientist is expected here")
     self.assertEqual(s["greatpersontype"], "Scientist")
     G.deleteGame()
Example #2
0
 def test4(self):
     print("Test BUYWONDER")
     G = TestHelper.DeployTestGame("test1", "game-54.json", "America")
     PA = G.playA()
     PA.readBoard()
     PA.playSingleCommand(CO.Command.GREATPERSONPUT,lambda x : misc.eqP({"row" : 2, "col" : 2}, x['p']),
                                               lambda b : misc.eqP({"row" : 1, "col" : 1}, b['p']) and b['greatperson'] == "AlanTuring")
     PA.readBoard()
     s = getSquare(PA, 1,1)
     print(s)
     print("Scientist is expected here")
     self.assertEqual(s["greatpersontype"], "Scientist")
     G.deleteGame()
Example #3
0
 def test3(self):
     print("Test BUYWONDER")
     G = TestHelper.DeployTestGame("test1", "game-53.json", "America")
     PA = G.playA()
     PA.readBoard()
     PA.playSingleCommand(CO.Command.BUYWONDER,lambda x : misc.eqP({"row" : 2, "col" : 2}, x['p']),
                                               lambda b : misc.eqP({"row" : 1, "col" : 1}, b['p']) and b['wonder'] == "TheColossus")
     PA.readBoard()
     s = getSquare(PA, 1,1)
     print(s)
     print("TheCollosus is expected to be there")
     self.assertEqual(s["wonder"], "TheColossus")
     G.deleteGame()
Example #4
0
 def test3(self):
     print("Test BUYBUILDING")
     G = TestHelper.DeployTestGame("test1", "game-43.json", "America")
     PA = G.playA()
     PA.readBoard()
     PA.playSingleCommand(
         CO.Command.BUYBUILDING, lambda x: misc.eqP({
             "row": 2,
             "col": 2
         }, x['p']), lambda b: misc.eqP({
             "row": 1,
             "col": 1
         }, b['p']) and b['building'] == "Temple")
     print("Check whether Temple is built on (1,1)")
     PA.readBoard()
     s = getSquare(PA, 1, 1)
     print(s)
     self.assertEqual(s["building"], "Temple")
     G.deleteGame()
Example #5
0
 def _run(self):
     G = TestHelper.DeployTestGame("test1", "game-32.json", "America")
     PA = G.playA()
     #        PA.playSingleCommand(CO.Command.STARTMOVE, lambda x : (x['p']['row'] == 2 and x['p']['col'] == 2))
     PA.readBoard()
     PA.playSingleCommand(CO.Command.STARTMOVE,
                          lambda x: misc.eqP({
                              "row": 2,
                              "col": 2
                          }, x['p']))
     PA.readBoard()
     PA.playSingleCommand(CO.Command.MOVE,
                          lambda x: misc.eqP({
                              "row": 2,
                              "col": 1
                          }, x))
     PA.readBoard()
     PA.playSingleCommand(CO.Command.MOVE,
                          lambda x: misc.eqP({
                              "row": 1,
                              "col": 1
                          }, x))
     PA.readBoard()
     return (G, PA)
Example #6
0
 def test1(self):
     print("Test SPENDTRADE")
     G = TestHelper.DeployTestGame("test1", "game-51.json", "America")
     PA = G.playA()
     PA.readBoard()
     s = getSquare(PA, 2, 2)
     print(s)
     t = getPlayerTrade(PA)
     print(t)
     self.assertEqual(s['production'],5)
     self.assertEqual(t,7)        
     PA.playSingleCommand(CO.Command.SPENDTRADE,lambda x : misc.eqP({"row" : 2, "col" : 2}, x['p']),param=3)
     PA.readBoard()
     s = getSquare(PA, 2, 2)
     print(s)
     print("Production increased to 8")
     self.assertEqual(s['production'],8)
     t = getPlayerTrade(PA)
     print(t)
     print("Trade decreased to 1 (7 - 2 * 3).")
     self.assertEqual(t,1)
     G.deleteGame()
Example #7
0
def onList(p, l):
    for i in l:
        if misc.eqP(i, p): return True
    return False