import unittest
from unittest.mock import patch
from print_map.game_objects import BoardMap, Character, Weapon, VitalStatus, Position, Game

SQUARES = [
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 1, 1, 0, 3, 1, 0, 1, 3,
    0, 1, 1, 0, 2, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 1, 1, 0,
    1, 1, 0, 1, 1, 0, 3, 1, 0, 2, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 5, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1
]
ROWS = 9
COLS = 9

board_map = BoardMap(ROWS, COLS)
board_map.create_squares_of_boardmap(SQUARES)

game = Game(board_map)

status_proportion = [0.5, 0.5, 0.7, 0.9, 0.8]
extra_level = 1
v_status_character = VitalStatus(10, 3, 4, 6, 20, status_proportion,
                                 extra_level)

v_status_weapon_1 = VitalStatus(2, 3, -1, 5, 1, None, 1)
v_status_weapon_2 = VitalStatus(2, 3, -2, 4, 1, None, 0)
v_status_weapon_3 = VitalStatus(2, 3, 5, 5, 3, None, -1)
v_status_weapon_4 = VitalStatus(2, 3, -1, 5, 1, None, 1)
v_status_weapon_5 = VitalStatus(1, 1, 1, 1, 1, None, 0)

weapon_1 = Weapon("Super sword", "This sword cuts what it wants.",
                  v_status_weapon_1)
Example #2
0
ROWS_1 = 3
COLS_1 = 3

SQUARES_2 = [1,1,1,1,1,1,1,1,1,
             1,4,0,0,0,0,0,0,1,
             1,0,3,1,0,1,3,0,1,
             1,0,2,1,0,1,1,0,1,
             1,0,0,0,3,0,0,0,1,
             1,0,1,1,0,1,1,0,1,
             1,0,3,1,0,2,3,0,1,
             1,0,0,0,0,0,0,5,1,
             1,1,1,1,1,1,1,1,1]
ROWS_2 = 9
COLS_2 = 9

board_map_3_x_3_monster = BoardMap(ROWS_1, COLS_1)
normal_map_3_x_3_monster = ConsoleInterface.print_map(board_map_3_x_3_monster, SQUARES_1)

board_map_9_x_9_cool_mix = BoardMap(ROWS_2, COLS_2)
cool_map_9_x_9 = ConsoleInterface.print_map(board_map_9_x_9_cool_mix, SQUARES_2)

class MyTestCase(unittest.TestCase):
    def test_normal_3_x_3(self):
        self.assertEqual(normal_map_3_x_3_monster, '╔═╗\n║M║\n╚═╝')

    def test_cool_9_x_9(self):
        self.assertEqual(cool_map_9_x_9, '╔═══════╗\n'
                                         '║S      ║\n'
                                         '║ M║ ║M ║\n'
                                         '║ -╝ ╚═ ║\n'
                                         '║   M   ║\n'
COLS_6 = 3

SQUARES_7 = [1,1,1,1,1,1,1,1,1,
             1,0,0,0,0,0,0,0,1,
             1,0,0,1,0,1,0,0,1,
             1,0,1,1,0,1,1,0,1,
             1,0,0,0,0,0,0,0,1,
             1,0,1,1,0,1,1,0,1,
             1,0,0,1,0,1,0,0,1,
             1,0,0,0,0,0,0,0,1,
             1,1,1,1,1,1,1,1,1]
ROWS_7 = 9
COLS_7 = 9


column_board_map = BoardMap(ROWS_1, COLS_1 )
empty_board_map = BoardMap(ROWS_2, COLS_2)
fake_column_board_map = BoardMap(ROWS_3, COLS_3)
map_2_x_2_board = BoardMap(ROWS_4, COLS_4)
normal_map_3_x_3_board = BoardMap(ROWS_5, COLS_5)
board_map_3_x_3_fake_column = BoardMap(ROWS_6, COLS_6)
board_map_9_x_9_normal = BoardMap(ROWS_7, COLS_7)

column = ConsoleInterface.print_map(column_board_map, SQUARES_1)
empty_map = ConsoleInterface.print_map(empty_board_map, SQUARES_2)
fake_column = ConsoleInterface.print_map(fake_column_board_map, SQUARES_3)
map_2_x_2 = ConsoleInterface.print_map(map_2_x_2_board, SQUARES_4)
normal_map_3_x_3 = ConsoleInterface.print_map(normal_map_3_x_3_board, SQUARES_5)
fake_column_3_x_3 = ConsoleInterface.print_map(board_map_3_x_3_fake_column, SQUARES_6)
normal_map_9_x_9 = ConsoleInterface.print_map(board_map_9_x_9_normal, SQUARES_7)
Example #4
0
import unittest
from print_map.game_objects import BoardMap, ConsoleInterface, Square, Position

position_1 = Position(0, 0)
position_2 = Position(-1, 0)
position_3 = Position(0, -1)
position_4 = Position(1, 0)
position_5 = Position(0, 1)
rows_1 = 1
cols_1 = 1

boardmap_1 = BoardMap(rows_1, cols_1)

square_1 = Square(position_1, 1, boardmap_1)

squares_6 = [1, 1, 1, 1, 3, 1, 1, 1, 1]

squares_7 = [1, 1, 1, 1, 3, 1, 1, 1]
rows_6 = 3
cols_6 = 3

board_map_3_x_3 = BoardMap(rows_6, cols_6)
board_map_3_x_3_8 = BoardMap(rows_6, cols_6)

board_map_3_x_3.create_squares_of_boardmap(squares_6)
board_map_3_x_3_8.create_squares_of_boardmap(squares_7)


class MyTestCase(unittest.TestCase):
    def test_correct_square(self):
        self.assertFalse(None, square_1)
from print_map.game_objects import ConsoleInterface

SQUARES_1 = [1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1]
ROWS_1 = 4
COLS_1 = 4

SQUARES_2 = [
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 1, 1, 0, 3, 1, 0, 1, 3,
    0, 1, 1, 0, 2, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 3, 0, 0, 0, 1, 1, 0, 1, 1, 0,
    1, 1, 0, 1, 1, 0, 3, 1, 0, 2, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 5, 1, 1, 1, 1,
    1, 1, 1, 1, 1, 1
]
ROWS_2 = 9
COLS_2 = 9

board_map_4_x_4_normal = BoardMap(ROWS_1, COLS_1)
board_map_4_x_4_normal.create_squares_of_boardmap(SQUARES_1)
square_1_2 = board_map_4_x_4_normal.squares[5]
#normal_map_4_x_4_normal = ConsoleInterface.print_map(board_map_4_x_4_normal, SQUARES_1)

board_map_9_x_9 = BoardMap(ROWS_2, COLS_2)
board_map_9_x_9.create_squares_of_boardmap(SQUARES_2)
#ConsoleInterface.print_map(board_map_9_x_9, SQUARES_2)
square_1_7_9x9 = board_map_9_x_9.get_square_by_position(1, 7)
square_4_4_9x9 = board_map_9_x_9.get_square_by_position(4, 4)
square_6_6_9x9 = board_map_9_x_9.get_square_by_position(6, 6)


class MyTestCase(unittest.TestCase):
    def test_get_square_by_position_correct(self):
        square_test_1_2 = board_map_4_x_4_normal.get_square_by_position(1, 2)