예제 #1
0
def grid_size():        #user can select size of connect 4 grid
        while True:
                print("\t1 = SMALL(5x4)\t 2 = Default(7x6)\t3 = Large(9x8)\n")
                print ("\t4 = Return to Mode Menu\n")
                try:            #try/except statement, prevents from python displaying error when excecuted
                        g =int(input("Enter the number of the grid you wish to play with: "))
                        print(" ")
                        if g == 1:                      #small connect 4 GUI grid  
                                g_gui = Grid_mode()     
                                g_gui.small_grid()
                                gui = g_gui
                                pause()
                                main()
                        elif g == 2:                    # standard 7x6 connect 4 GUI grid
                                b_gui = GameGUI()
                                b_gui.intialise_dynamic()
                                gui = b_gui
                                pause()
                                main()
                        elif g == 3:                    # large connect 4 GUI grid
                                g_gui = Grid_mode()
                                g_gui.large_grid()
                                gui = g_gui
                                pause()
                                main()
                        elif g == 4:
                                modes_menu()            #retruns to modes_menu
                                
                        else:
                                print("")
                                print("invalid menu option")
                                grid_size()
                except ValueError:                      # if user enters a value/number the print statement displayed
                    print("\nTry Again!!!")
예제 #2
0
def load_board():       #refrences the GUI of connect 4, however it also refereces the loading method. This is to load the game into the GUI.
        b_gui = GameGUI()
        b_gui.load = True;
        b_gui.intialise_dynamic()
        gui = b_gui
예제 #3
0
def plays():    # the play method which is is called by the game_menu
        
        b_gui = GameGUI()               # assign the class of the standard Connect 4 game GUI to variable b_gui (creates new instance of class)  
        b_gui.intialise_dynamic()       # creating a method reference to the creation of the Connect 4 Grid GUI
        gui = b_gui                     # assigning the variable to the file