Dec-05-2019, 08:03 AM
I am creating a sign-reversal puzzle. That should have a 6x6 array with an initial value given. Player need to choose a row to reverse the sign in each turn and game will sum the column. The game ends if the player could change the row sums and column sums to non-negative values if the initial ones are not all non-negative value.
However, it is hard to start. I have built a welcome page of the game... And somehow I think I am not doing it in the right way, I really need some help! Below are my codes for the welcome page I built.
However, it is hard to start. I have built a welcome page of the game... And somehow I think I am not doing it in the right way, I really need some help! Below are my codes for the welcome page I built.
from tkinter import *
from tkinter import messagebox
top = Tk()
top.geometry("500x500")
# def header():
# messagebox.showinfo("Welcome to Sign-Reversal Puzzle game", "Hello players!")
w = Label (top, text = "Welcome to Sign-Reversal Puzzle game!")
w.pack()
def play():
messagebox.showinfo("Play game", "This is the game")
def instruction():
messagebox.showinfo("Instruction", "The game rules are as below: ")
messagebox.showinfo("First Step", "Given a 6x6 array with values, player need to choose a row to change sign")
messagebox.showinfo("Second Step", "After changing the sign, we will change sum the rows and columns")
messagebox.showinfo("How to win?", "Have all row sums and column sums to non-negative values")
B1 = Button(top, text = "Welcome to Sign-Reversal Puzzle game", command = header)
B1.place(x = 100,y = 10)
B2 = Button(top, text = "Play game", command = play)
B2.place(x = 35, y = 60)
B3 = Button(top, text = "Instruction", command = instruction)
B3.place(x = 35, y = 90)
top.mainloop()
