reset game

This commit is contained in:
Michael Pilosov 2024-05-09 17:06:01 -06:00
parent d73ab1bbcf
commit d59f05e33a
2 changed files with 14 additions and 0 deletions

12
main.py
View File

@ -72,6 +72,14 @@ def display_board(board, piece, i, j):
print()
def game_over(board):
print("GAME OVER! The pieces reached the top.")
# Optionally clear the board or exit the game
return np.zeros_like(
board
) # Clear the board and continue or call sys.exit() to end
def main():
board = np.zeros((20, 10), dtype=int)
piece_types = list(PIECES.keys())
@ -82,6 +90,10 @@ def main():
while True:
display_board(board, current_piece, i, j)
if not check_placement(current_piece, board, *START_POS):
board = game_over(board)
continue
command = input(
"Enter command (a=left, d=right, s=down, w=rotate, S=drop, G=toggle gravity, Q=quit): "
)

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
numpy