Python Forum
A sign-Reversal Puzzle
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A sign-Reversal Puzzle
#1
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.

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()
Reply
#2
missing header and shouldn't be a function (as in you're commented out line 8)
Reply
#3
Yes, I comment it wrongly. I should comment the codes in line 11-12. After I correct the comment it is executable. But it is the right way to build a game welcome page?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with ‘>’ (i.e. greater than) sign AOCL1234 2 1,904 Jun-30-2020, 09:32 PM
Last Post: Yoriz
  8 puzzle game aliyark145 4 10,622 May-30-2020, 05:54 PM
Last Post: Alkis
  Cross word puzzle solve using python constraint library aliyark145 1 3,248 Nov-29-2018, 10:53 AM
Last Post: Larz60+
  creating functions - make optional argument a reversal anstuteville 2 2,554 Aug-31-2018, 02:36 PM
Last Post: anstuteville
  Simple Eight-Puzzle not working! BenjaminDJ 2 3,131 May-04-2018, 12:17 PM
Last Post: BenjaminDJ
  Making a calculator with just the + sign gerardmanken 1 2,825 Feb-01-2018, 03:18 PM
Last Post: buran
  User sign up and login system tesilstudent112 1 5,050 Oct-22-2017, 10:14 AM
Last Post: metulburr
  Magic Square Puzzle Harnick 1 4,843 Aug-09-2017, 04:51 PM
Last Post: nilamo
  Image Puzzle Digitalchemist 6 7,220 Jun-05-2017, 07:56 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020