Skip to content

Commit

Permalink
cleanup setup
Browse files Browse the repository at this point in the history
  • Loading branch information
CKjolhede committed Jun 20, 2024
1 parent 37ad0a2 commit 981a2d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
12 changes: 3 additions & 9 deletions lib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ def exit_program():
print("Goodbye!")
exit()

def exit_program_early(game, players, homes):
for player in players:
Player.delete(player)
for home in homes:
Game_space.delete(home)
def exit_program_early(game):
Game.delete(game)
os.system('clear')
print("Goodbye!")
Expand All @@ -72,7 +68,7 @@ def new_game_setup(game):
os.system('clear')
start_game(game)
elif choice == "4":
exit_program()
exit_program_early()
else:
os.system('clear')
print("That is not a valid input.")
Expand Down Expand Up @@ -115,10 +111,8 @@ def player_setup(game):
os.system('clear')
new_game_setup(game)
elif choice == "6":
players = Player.get_all_players_by_gameid(game.id)
homes = Game_space.get_all_homes_by_gameid(game.id)
os.system('clear')
exit_program_early(game, players, homes)
exit_program_early(game)
else:
os.system('clear')
print("Invalid choice, please select again")
Expand Down
2 changes: 1 addition & 1 deletion lib/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sqlite3

CONN = sqlite3.connect('./lib/monopolython.db')
CONN = sqlite3.connect('./monopolython.db')
CURSOR = CONN.cursor()
20 changes: 2 additions & 18 deletions lib/models/setup_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,5 @@
from models.game import Game
from models.__init__ import CONN, CURSOR

player_house_positions = [4, 10, 16, 22]
player_home_position = random.sample(player_house_positions, k=4)

def exit_program():
os.system('clear')
print("Goodbye!")
exit()

def exit_program_early(game, players, homes):
for player in players:
Player.delete(player)
for home in homes:
Game_space.delete(home)
Game.delete(game)
os.system('clear')
print("Goodbye!")
exit()

def base():
pass

0 comments on commit 981a2d8

Please sign in to comment.