-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
43 lines (39 loc) · 1.32 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
from cli import main as cli_main
from gui import main as gui_main
def display_interface_menu():
"""
Display the main menu for choosing the interface.
"""
print("\n" + "="*40)
print(" Welcome to ChessBot!")
print("="*40)
print("Select an interface to start playing:")
print("1. Command-Line Interface (CLI)")
print("2. Graphical User Interface (GUI)")
print("3. Exit")
print("="*40)
print("Enter the number of your choice and press Enter.")
def main():
"""
Entry point for ChessBot. Lets the user pick an interface.
"""
while True:
display_interface_menu()
choice = input("Your choice: ").strip()
if choice == "1":
print("\nStarting the CLI version of ChessBot...\n")
cli_main() # Launch the CLI
elif choice == "2":
print("\nAttempting to start the GUI version of ChessBot...")
try:
gui_main() # Launch the GUI
except ImportError:
print("\nGUI not available. Please ensure all GUI dependencies are installed.\n")
elif choice == "3":
print("\nExiting ChessBot. Thanks for playing!")
sys.exit(0)
else:
print("\nInvalid choice. Please enter 1, 2, or 3.\n")
if __name__ == "__main__":
main()