| | |
Memory game
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
I need help to get started with this. Any one that knows any examples I can get inspire from?
Im going to create a game that plays Memory. The user should try to solve a
6x6 matrix by matching words in different cells in a matrix.It should look like this:
1 2 3 4 5 6
A - - - - - --
B - - - - - --
C - - - - - --
D - - - - - --
E - - - - - --
F - - - - - --
==================
Choice1: A5
1 2 3 4 5 6
A - - - - fun --
B - - - - - --
C - - - - - --
D - - - - - --
E - - - - - --
F - - - - - --
==================
Choice2: B7,
etc. ...
Im going to create a game that plays Memory. The user should try to solve a
6x6 matrix by matching words in different cells in a matrix.It should look like this:
1 2 3 4 5 6
A - - - - - --
B - - - - - --
C - - - - - --
D - - - - - --
E - - - - - --
F - - - - - --
==================
Choice1: A5
1 2 3 4 5 6
A - - - - fun --
B - - - - - --
C - - - - - --
D - - - - - --
E - - - - - --
F - - - - - --
==================
Choice2: B7,
etc. ...
Okay, do you have any code so-far or are you starting from scratch?
Last edited by Paul Thompson; Nov 3rd, 2008 at 3:22 pm.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
Okay, well here is one i knocked together, it dosent let you win but it has a lot of the features you will need:
python Syntax (Toggle Plain Text)
import random def start(): words = ['one','one','two','two','three','three', 'four','four','five','five','six','six'] d = {} random.shuffle(words) for index, word in enumerate(words): d[index] = word return d def printboard(d,revealed): side = 1 print " 1 2 3 4" print "A", for i,f in enumerate(d.keys()): if revealed[i]: print d[f], else: print '--', if (i+1)%4==0: if i==3: print "B", elif i == 7: print "C", def guess(rev): values= {'a':0, 'b':4, 'c':8} row = raw_input("\nWhat row do you choose? (a,b,c)").lower() col = input("What column do you choose? (1,2,3,4)") row = values[row] total = row+col-1 if rev[total]==True: rev[total]='already_guessed' else: rev[total] = True return rev, total def Main(): rev = [False for f in range(12)] d = start() while True: printboard(d,rev) rev, total = guess(rev) printboard(d,rev) rev, total2 = guess(rev) if d[total]==d[total2]: print "\nGreat you got one" else: printboard(d,rev) print "\nOh no, not this time" raw_input("enter to continue") if rev[total] == 'already_guessed': pass else: rev[total]=False if rev[total2] == 'already_guessed': pass else: rev[total2] = False if __name__ == '__main__': Main()
Last edited by Paul Thompson; Nov 4th, 2008 at 5:26 pm.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Similar Threads
- Beautyfull Memory Game (Geeks' Lounge)
- Spark Game (Highly Addictive) (Geeks' Lounge)
- Memory game with c++ console applicaton (C++)
- why wont my flash game work? (Graphics and Multimedia)
- why i can not load game on one partition but can on aother (Troubleshooting Dead Machines)
- Freezes and Odd things after memory upgrade (Windows NT / 2000 / XP)
- Big Game need progrmmers (C++)
- SHUTDOWNS, new video card (Monitors, Displays and Video Cards)
Other Threads in the Python Forum
- Previous Thread: boost python question
- Next Thread: Need a bit of Help
| Thread Tools | Search this Thread |
Tag cloud for Python
accessdenied apache application argv beginner book change code color dictionary dynamic edit editing enter examples excel file filename float format ftp function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql newb number numbers numeric output parameters parsing path port prime program programming projects py2exe pygame pyopengl pyqt python random recursion recursive redirect remote reverse rpg scrolledtext search server session simple smtp software sprite ssh statictext string strings syntax table tennis terminal text thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython






