I'm trying to create a pattern game (In python 3.5) where the user can input the number of steps they want to attempt and then use keys on the keyboard to recreate the pattern using the U,I,J,K keys.
This is all I have so far and I'm completely stuck. Thanks for any help.
from time import *
import random
from random import randrange
from cImage import *
default = FileImage("comp_def.gif")
compblue = FileImage("comp_blue.gif")
compgreen = FileImage("comp_green.gif")
compred = FileImage("comp_red.gif")
compyellow = FileImage("comp_yellow.gif")
greenman = FileImage("green_man.gif")
yellowman = FileImage("yellow_man.gif")
redman = FileImage("red_man.gif")
blueman = FileImage("blue_man.gif")
playerdef = FileImage("player_def.gif")
window = ImageWin("Simon Says", 640, 480)
compturn = [compblue, compgreen, compred, compyellow]
pattern = []
playerpattern = []
rand = random.choice(compturn)
game = input('Welcome to Simon Says! Use the U I J & K keys to play. When you are ready to play press S followed by the enter key')
if game == 'S' or 's':
play = input('What length of pattern would you like to atempt?')
for i in range(play):
rand.append(random.randrange(compturn)
rand.draw(window)
sleep(2)
else:
print("Command not recognized")
Aucun commentaire:
Enregistrer un commentaire