class PygameUtilityTests(unittest.TestCase):
    # Tests for project Connect-N.
    def setUp(self):
        """setUp"""
        self.game = ConnectNGame(graphic=True, ai=True)

    def tearDown(self):
        """tearDown"""
        self.game.reset()
        del self.game

    def test_play(self):
        """Testing graphic play method"""
        self.game.players.append(AI(self.game, 2))
        self.game.play()
        self.assertEqual(self.game.winner.name, "AI")
Exemple #2
0
@author: Kartikei Mittal

@email: [email protected]

main.py file for demostrating use of connect_n module.

https://github.com/Kartikei-12/Connect-N
"""

__author__ = "Kartikei Mittal"
__email__ = "*****@*****.**"

# User module(s)
from connect_n.player import Player
from connect_n.connect_n import ConnectNGame

if __name__ == "__main__":
    # Main program block of the project.
    print(
        "Hello World!!\n---------------------------------------------------------"
    )
    game = ConnectNGame(graphic=True, ai=True, record=True)
    print(game)
    print(game.__version__)
    game.add_player(Player("Mr.REX"))
    # game.add_player(Player("B"))
    game.play()
    print(
        "-----------------------------------------------------------\nBye World!!"
    )