Пример #1
0
 def test_createNewGame_stateOfTwoPlayers(self):
     colors = (
         'red',
         'blue',
     )
     elasund = Elasund(colors)
     state = elasund.getState()
     self.assertEqual(state, 'income')
     self.assertEqual(len(elasund.getPlayers()), 2)
Пример #2
0
    def test_build(self):
        colors = (
            'red',
            'blue',
            'green',
            'yellow',
        )
        elasund = Elasund(colors)
        player = elasund.getCurrentPlayer()
        player.gold = 3

        elasund.income()
        error = elasund._board.putClaim(elasund.getCurrentPlayer().getColor(),
                                        1, (5, 5))
        self.assertIsNone(error)
        error = elasund._board.putClaim(elasund.getCurrentPlayer().getColor(),
                                        0, (6, 6))
        self.assertIsNone(error)

        buildings = elasund.getBuildings()
        self.assertEqual(len(buildings['hotel']), 5)

        error = elasund.build((5, 5), buildings['hotel'][0])
        self.assertTrue(error['success'])

        self.assertEqual(len(buildings['hotel']), 4)
Пример #3
0
 def test_createNewGame_stateOfFivePlayers(self):
     colors = (
         'red',
         'blue',
         'green',
         'yellow',
         'purple',
     )
     elasund = Elasund(colors)
     state = elasund.getState()
     self.assertEqual(state, 'error')
     self.assertEqual(len(elasund.getPlayers()), 0)
Пример #4
0
 def test_decorator_income(self):
     colors = ('red', 'blue', 'green', 'yellow')
     elasund = Elasund(colors)
     self.assertEqual(elasund.getState(), 'income')
     result = elasund.income()
     self.assertTrue(result['success'])
     self.assertEqual(elasund.getState(), 'building')
     result = elasund.income()
     self.assertEqual(result, 'Error: current state is not income')
     self.assertEqual(elasund.getState(), 'building')
Пример #5
0
import pygame
from pygame.locals import *

from managers.texture_manager import TextureManager
from constants.colors import Colors
from core.Elasund import Elasund

elasund = Elasund(('red', 'blue', 'green', 'yellow'))

pygame.init()
fpsClock = pygame.time.Clock()
fps = 60

windowRootSurface = pygame.display.set_mode((1200, 800))

tm = TextureManager('../textures/')

pygame.display.set_caption('Elasund')
pygame.display.set_icon(tm.textures['icon'])
pygame.mouse.set_visible(False)

colors = Colors()

mouse_pos = (0, 0)

#cursor_color = colors.GREEN

MOUSE_BUTTON_LEFT = 1
MOUSE_BUTTON_RIGHT = 3

Пример #6
0
 def test_createNewGame_stateOfOnePlayers(self):
     colors = ('red', )
     elasund = Elasund(colors)
     state = elasund.getState()
     self.assertEqual(state, 'error')
     self.assertEqual(len(elasund.getPlayers()), 0)
Пример #7
0
import pygame
from pygame.locals import *

from managers.texture_manager import TextureManager
from constants.colors import Colors
from core.Elasund import Elasund

elasund = Elasund(('red', 'blue', 'green', 'yellow'))

pygame.init()
fpsClock = pygame.time.Clock()
fps = 60

windowRootSurface = pygame.display.set_mode((1200, 800))

tm = TextureManager('../textures/')

pygame.display.set_caption('Elasund')
pygame.display.set_icon(tm.textures['icon'])
pygame.mouse.set_visible(False)

colors = Colors()

mouse_pos = (0, 0)

#cursor_color = colors.GREEN

MOUSE_BUTTON_LEFT = 1
MOUSE_BUTTON_RIGHT = 3