<commit_before>'''
Author:   <NAME>
Created:  6/29/16

Description:
This class serves as a container for all the components of the game in its current
state: players, squares, chance/community chest cards, etc. Any changes to the state
of the game should go through this object via the state-changing methods.


TODO
In-line:
1)  Assumes Square/Card class initializes by its name, as specified in squares.txt.
2)  Insert checks to ensure even building given the GSC that builds houses
'''

class GameState(object):
  # Constants
  NUM_HOUSES = 32
  NUM_HOTELS = 12

  # Initialization
  def initialize_players(num_players):
    players = []
    for i in range(0, num_players):
      players.append(Player())
    return players

  def initialize_squares():
    squares_file = "squares.txt"
    squares = []
    f = open(squares_file, "r")
    square_names = f.read().split("\n")
    for square_name in square_names:
      squares.append(Square(square_name)) # TODO 1
    return squares

  def __init__(self, num_players):
		self._players                = initialize_players(num_players)
		self._squares                = initialize_squares()
		self._total_houses           = NUM_HOUSES
		self._total_hotels           = NUM_HOTELS

  # Private
  def _copy(self):
		num_players = len(self._players)
		copy = GameState(num_players)
		for i in range(0, num_players):
			copy._players[i] = self._players[i]
		for square in self._squares:
			copy._squares.append(square)
		copy._total_houses = self._total_houses
		copy._total_hotels = self._total_hotels
		return copy

  # Getters
  @property
  def squares(self):
  	return self._squares
  
  @property
  def players(self):<commit_msg>Corrected copy method in GameState to make deep copies<commit_after>'''
Author:   <NAME>
Created:  6/29/16

Description:
This class serves as a container for all the components of the game in its current
state: players, squares, chance/community chest cards, etc. Any changes to the state
of the game should go through this object via the state-changing methods.


TODO
In-line:
1)  Assumes Square/Card class initializes by its name, as specified in squares.txt.
2)  Insert checks to ensure even building given the GSC that builds houses
'''

class GameState(object):
  # Constants
  NUM_HOUSES = 32
  NUM_HOTELS = 12

  # Initialization
  def initialize_players(num_players):
    players = []
    for i in range(0, num_players):
      players.append(Player())
    return players

  def initialize_squares():
    squares_file = "squares.txt"
    squares = []
    f = open(squares_file, "r")
    square_names = f.read().split("\n")
    for square_name in square_names:
      squares.append(Square(square_name)) # TODO 1
    return squares

  def __init__(self, num_players):
		self._players                = initialize_players(num_players)
		self._squares                = initialize_squares()
		self._total_houses           = NUM_HOUSES
		self._total_hotels           = NUM_HOTELS

  # Private
  def _copy(self):
		num_players = len(self._players)
		copy = GameState(num_players)
		for i in range(0, num_players):
			copy._players[i] = self._players[i].copy()
		for square in self._squares:
			copy._squares.append(square.copy())
		copy._total_houses = self._total_houses
		copy._total_hotels = self._total_hotels
		return copy

  # Getters
  @property
  def squares(self):
  	return self._squares
  
  @property
  def players(self):
{'fraction_non_alphanumeric': 0.08795074758135445, 'fraction_numerical': 0.008208736440926415, 'mean_word_length': 3.3799743260590502, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4458175', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1086, 'n_words': 319}