82 lines
2.0 KiB
Python
82 lines
2.0 KiB
Python
import House
|
|
import Field
|
|
|
|
class Board(object):
|
|
|
|
""":version: 0.1
|
|
:author: Martin Putzlocher
|
|
"""
|
|
|
|
""" ATTRIBUTES
|
|
list_all_fields (private)
|
|
"""
|
|
|
|
def __init__(self, colors:list, number_of_players=4):
|
|
self.colors = colors
|
|
self.num_players = number_of_players
|
|
self._list_all_fields = list()
|
|
self.init_board()
|
|
|
|
def get_house_by_color(self, color = "black"):
|
|
"""Returns list of house fields of one color
|
|
|
|
:param string: color :
|
|
:param color: (Default value = "black")
|
|
:returns: House :
|
|
|
|
"""
|
|
pass
|
|
|
|
def init_board(self):
|
|
"""Initialize Board
|
|
|
|
|
|
:returns: author
|
|
|
|
"""
|
|
for n in range(self.num_players):
|
|
for i in range(10):
|
|
f = Field.Field(self, i, self.colors[n], house=False)
|
|
self._list_all_fields.append(f)
|
|
|
|
IDlist = [f.get_id() for f in self._list_all_fields]
|
|
print(IDlist)
|
|
|
|
def get_next_standard_field(self, current_field):
|
|
"""
|
|
|
|
:param Field: current_field :
|
|
:param current_field:
|
|
:returns: Field :
|
|
@author
|
|
|
|
"""
|
|
current_index = self._list_all_fields.index(current_field)
|
|
next_field = self._list_all_fields[current_index + 1]
|
|
return next_field
|
|
|
|
def get_next_field_by_color(self, current_field, color_of_stone = "black"):
|
|
"""
|
|
|
|
:param Field: current_field : Current field
|
|
:param string: color : Color of the stone requesting his next field.
|
|
:param current_field:
|
|
:param color: (Default value = "black")
|
|
:returns: Field :
|
|
@author
|
|
|
|
"""
|
|
current_field_color = current_field.get_color()
|
|
next_field = self.get_next_standard_field(current_field)
|
|
next_field_color = next_field.get_color()
|
|
|
|
if color_of_stone == next_field_color and current_field_color != next_field_color:
|
|
# TODO
|
|
# next_field = im Haus des aktuellen Spielers
|
|
pass
|
|
else:
|
|
pass
|
|
return next_field
|
|
|
|
|