Example #1
0
 def test_ATC_003_006(self):
     '''Game Draw test'''
     GameBoard = Board()
     GameBoard.InitBoard(COLOR['WHITE'])
     Arithmetic = Verdict(GameBoard.BeadArry)
     Displayer = GameIO(GameBoard)
     Displayer.PrintGameBoard()
     result = Arithmetic.VerdictDraw()
     self.assertAlmostEqual(True, True)
Example #2
0
 def test_ATC_002_003(self):
     '''LeftUp Corner RightDown 3 Continuous Bead,Check Winner'''
     GameBoard = Board()
     HuManPlayer = Human(COLOR['WHITE'], GameBoard)
     bead = HuManPlayer.DownBeadAtPos(0, 0)
     GameBoard.AddBead(bead)
     bead = HuManPlayer.DownBeadAtPos(1, 1)
     GameBoard.AddBead(bead)
     bead = HuManPlayer.DownBeadAtPos(2, 2)
     GameBoard.AddBead(bead)
     Arithmetic = Verdict(GameBoard.BeadArry)
     WinnerColor = Arithmetic.VerdictWinner(3)
     Displayer = GameIO(GameBoard)
     Displayer.PrintGameBoard()
     self.assertEqual(COLOR['WHITE'], WinnerColor)
Example #3
0
    def test_ATC_001_001(self):
        '''Check Continuous Bead Cnt'''
        GameBoard = Board()
        HuManPlayer = Human(COLOR['WHITE'], GameBoard)
        bead = HuManPlayer.DownBeadAtPos(0, 0)
        GameBoard.AddBead(bead)
        bead = HuManPlayer.DownBeadAtPos(1, 0)
        GameBoard.AddBead(bead)
        bead = HuManPlayer.DownBeadAtPos(2, 0)
        GameBoard.AddBead(bead)
        Arithmetic = Verdict(GameBoard.BeadArry)
        SameCount = Arithmetic.GetSameColorBeadCnt(range(9), [0] * 9)
        SameCount1 = Arithmetic.GetSameColorBeadCnt([0] * 9, range(9))
        Displayer = GameIO(GameBoard)
        Displayer.PrintGameBoard()

        self.assertEqual(3, SameCount)
        self.assertEqual(1, SameCount1)
Example #4
0
 def test_ATC_002_005(self):
     '''Center Corner Up 3 Continuous Bead,Check Winner'''
     GameBoard = Board()
     HuManPlayer = Human(COLOR['WHITE'], GameBoard)
     bead = HuManPlayer.DownBeadAtPos(2, 3)
     GameBoard.AddBead(bead)
     bead = HuManPlayer.DownBeadAtPos(3, 3)
     GameBoard.AddBead(bead)
     bead = HuManPlayer.DownBeadAtPos(1, 3)
     GameBoard.AddBead(bead)
     PcPlayer = Pc(COLOR['BLACK'], GameBoard)
     bead = PcPlayer.DownBead()
     GameBoard.AddBead(bead)
     Arithmetic = Verdict(GameBoard.BeadArry)
     WinnerColor = Arithmetic.VerdictWinner(3)
     Displayer = GameIO(GameBoard)
     Displayer.PrintGameBoard()
     self.assertEqual(COLOR['WHITE'], WinnerColor)
Example #5
0
 def __initGame(self):
     self.__winNumCondition = 3
     self.__startPlayer = 'Pc'
     self.__gameBoard = Board()
     self.__memory = Memory()
     self.__verdict = Verdict(self.__gameBoard.BeadArry)
     self.__gameIO = GameIO(self.__gameBoard)
     self.__playerHM = Human(COLOR['WHITE'], self.__gameBoard)
     self.__playerPc = Pc(COLOR['BLACK'], self.__gameBoard)
     self.SaveGame()