I fixed the flickering! And I have an interior!

This commit is contained in:
Cory 2024-05-21 19:11:03 -04:00
parent 33c496ac46
commit e7f8ec11c5
8 changed files with 7 additions and 20 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,10 +28,6 @@ class Cursor:
if game.on_board(new_position): if game.on_board(new_position):
if game.is_empty(new_position): if game.is_empty(new_position):
self.position = new_position self.position = new_position
else:
def hide(self): game.get_agents_by_position()[new_position][0].display = False
''' self.position = new_position
This is called because I was calling this method based on an agent's location, but I don't need the
cursor to do anything.
'''
pass

View File

@ -6,7 +6,6 @@
class FreeSpace: class FreeSpace:
character = '*' character = '*'
display = True
revealed = False revealed = False
neighbors = 0 neighbors = 0
@ -77,9 +76,7 @@ class FreeSpace:
Make sure a number is hidden when the cursor is over it. This is needed to allow the cursor to move Make sure a number is hidden when the cursor is over it. This is needed to allow the cursor to move
over a spot where a number is. over a spot where a number is.
''' '''
if (not game.is_empty(self.position)) and self.revealed and self.display == True: if game.is_empty(self.position) and self.revealed and self.display == False:
self.display = False
elif game.is_empty(self.position) and self.revealed and self.neighbors > 0 and self.display == False:
self.display = True self.display = True

View File

@ -30,12 +30,9 @@ class Mine:
def play_turn(self, game): def play_turn(self, game):
''' '''
Make sure the mine is hidden when the cursor is over it. This is needed to allow the cursor to move Make sure the mine appears when the cursor is not on it.
over a spot where a mine is.
''' '''
if (not game.is_empty(self.position)): if game.is_empty(self.position):
self.display = False
elif game.is_empty(self.position):
self.display = True self.display = True
def reveal(self): def reveal(self):

View File

@ -45,9 +45,6 @@ class Spawner:
cursor = Cursor((self.board_width - 1, self.board_height - 1)) cursor = Cursor((self.board_width - 1, self.board_height - 1))
game.add_agent(cursor) game.add_agent(cursor)
# Print instructions. # Print instructions.
game.log("To move, use the arrow keys. You may have to") game.log("To move, use the arrow keys. To select a space, ")
game.log("press an arrow key more than once to move.")
game.log("Please make sure the cursor is where you want it")
game.log("before selecting a space. To select a space, ")
game.log("press return. The game is over when all spots") game.log("press return. The game is over when all spots")
game.log("with mines are surrounded by numbers.") game.log("with mines are surrounded by numbers.")