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. ...

Recommended Answers

All 3 Replies

Okay, do you have any code so-far or are you starting from scratch?

I need help to get started with this. Any one that knows any examples I can get inspire from? :)

Looks like he's starting from scratch.

Okay, well here is one i knocked together, it dosent let you win but it has a lot of the features you will need:

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
                print "B",

            elif i == 7:
                print
                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()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.