Пример #1
0
 def test_clear(self):
   tttS = TickTackTooStage()
   tttS.setStage("001021020")
   tttS.setX("C3")
   self.assertEqual(tttS.stage[11][23],'X')
   tttS.clear()
   self.assertEqual(tttS.stage[11][23],' ')
Пример #2
0
 def test_setX(self):
   tttS = TickTackTooStage()
   self.assertEqual(tttS.stage[6][14],' ')
   tttS.setX("B2")
   self.assertEqual(tttS.stage[6][14],'\\')
   self.assertEqual(tttS.stage[2][6],' ')
   tttS.setX("1A")
   self.assertEqual(tttS.stage[2][6],'\\')
   self.assertRaises(KeyError,tttS.setO,"aaaa")
Пример #3
0

    if who=="S":
        # chat and information
        if typ in ("_info","_chat","_error","wrong"):
            print("\r",end="")
            print(message)
        if typ == "_start":
            stage.printStage()
            print("\r",end="")
            print(message)

        # moves
        try:
            if typ == "move_X":
                stage.setX(message)
                stage.printStage()
            if typ == "move_O":
                stage.setO(message)
                stage.printStage()
            if typ == "stage":
                stage.setStage(message)
                stage.printStage()

        except (KeyError,TypeError):
            client.sendMessage("stage","Send all stage")

        # stop game
        if typ in ("_stop","draw"):
            print("\r",end="")
            print(message)