Esempio n. 1
0
    def testPlayerBothZeroRewardIfGameGoing(self):
        pongGame = Pong()

        pongGame.makeMove(1, NOTHING)
        pongGame.makeMove(2, NOTHING)

        self.assertEqual(pongGame.getReward(1), 0)
        self.assertEqual(pongGame.getReward(2), 0)
Esempio n. 2
0
    def testPlayerTwoNegativeRewardIfLost(self):
        ballPosition = np.array([99.5, 2])
        ballVelocity = np.array([2, 0.1])
        pongGame = Pong(ballVelocity, ballPosition)
        expectedReward = -100

        pongGame = pongGame.makeMove(1, NOTHING)
        pongGame = pongGame.makeMove(2, NOTHING)

        self.assertEqual(expectedReward, pongGame.getReward(2))