responded to a couple comments. As mentioned before, I've got some work to do reworking game and view to actually do their jobs.

This commit is contained in:
Finn Goehrig 2023-07-03 11:49:21 -04:00
parent 32b944a6db
commit 6de2542e08
3 changed files with 17 additions and 10 deletions

View File

@ -14,11 +14,18 @@ class Board:
def get_initial_state(self):
# For now we will use a 4x4 board and place the amazons in the middle
# four squares, diagonlally from eachother for symmetry.
# Note that because the board is symettrical, one of the players must
# Note that because the board is symetrical, one of the players must
# have an advantage... but is it player 1 or player 2?
# CP: How does it follow that symmetrical board -> imbalance?
# FG: It's because going first must therefore either be an advatage or
# disadvantage, since geometrically the starting positions are identical.
# CP: What if a game worked by flipping a coin at the beginning of each turn
# CP: to decide which player will play?
# FG: Of course, I suspect it would be a much worse game lol.
# FG: You might consider also adding random elements, like rolling
# FG: a die to see the maximum distance you can move on a turn.
# FG: However, aside from mathematic and computational curiosity,
# FG: it's not clear to me why we would want to bother implementing it.
return [[0,0,0,0],[0,2,3,0],[0,3,2,0],[0,0,0,0]]
def get_active_player_code(self):
@ -147,7 +154,7 @@ class Board:
# Don't forget that while we say (x,y), the indices are refernced as [y][x]
# since the rows are above and below eachother (y) and columns adjacent (x):
if (x in range(len(self.state[0]))) and (y in range(len(self.state[0]))):
# This could be simplified to:
# This could be simplified to:
# return self.state[x][y] == 0
if self.state[x][y] == 0:
return True

View File

@ -3,9 +3,9 @@ from view import *
board = Board()
# CP: Different notation systems should be aligned with different layers in the
# CP: Different notation systems should be aligned with different layers in the
# application. The Board knows nothing of 'a' or '4'. This intuition suggests that
# `translator` and `good_square_checker` should be methods of a View. The entire
# `translator` and `good_square_checker` should be methods of a View. The entire
# View is swappable if we later switch to another View (e.g. my Retro app)
# CP: Should scale to n*n boards
translator = {
@ -32,9 +32,9 @@ def turn():
tui(board)
print("Valid coordinates look like: \'b2\' or \'c4\'")
# CP: Use None to represent nullity
amazon = 'none'
move = 'none'
burn = 'none'
amazon = None
move = None
burn = None
while good_square_checker(amazon) == False:
amazon = input("Choose a square containing the amazon of your choice: ")
while good_square_checker(move) == False:

View File

@ -1,10 +1,10 @@
from board import *
from os import system, name
# It's probably cleanest for the view to be a class and for it
# to handle all input-output to the user, including
# It's probably cleanest for the view to be a class and for it
# to handle all input-output to the user, including
# - rendering board state
# - representing
# - representing
def clear():
if name == 'nt':