If you have python then jsut run this code in a file with the .py extension from a terminal with the python or equivalent (Eg, python2.x) command.
Code: Select all
#!/usr/bin/env python
import random,os,time
nouns = ["advice","anger","answer","apple","arithmetic","badge","basket","basketball","battle","beast","beetle","beggar","brain","branch","bubble","bucket","cactus","cannon","cattle","celery","cellar","cloth","coach","coast","crate","cream","daughter","donkey","drug","earthquake","feast","fifth","finger","flock","frame","furniture","geese","ghost","giraffe","governor","honey","hope","hydrant","icicle","income","island","jeans","judge","lace","lamp","lettuce","marble","month","north","ocean","patch","plane","playground","poison","riddle","rifle","scale","seashore","sheet","pavement","skate","slave","sleet","smoke","stage","station","thrill","throat","throne","title","toothbrush","turkey","underwear","vacation","vegetable","visitor","voyage","year","monkey","banana","telephone","robot","water","bomb","chocolate","fire","ring","boat","camera","tomato","wrench","flour","milk","paint","pie","shovel","axe","wall","carrot","bath"]
while 1:
print "A number of words will appear for 5 seconds each. Try to remember them in the order they appear. After all the words have been given you will need to type the words you saw in order, afterwards. You will then be given a score."
while 1:
try:
number = int(raw_input("How many words? (5-105): "))
if number > 4 and number < 106:
break
except ValueError:
print "Error: Not a number."
words = random.sample(nouns, number)
for word in words:
os.system("clear")
print
print " " + word
time.sleep(5)
os.system("clear")
score = 0
answers = []
for word in words:
ans = (raw_input("Give the next word: ")).lower()
answers.append(ans)
if ans == word:
score += 1
print "You scored " + str(score) + "/" + str(number)
print "Actual - Yours"
for x in xrange(len(words)):
print words[x] + " - " + answers[x]
while 1:
ans = raw_input("Play again? (Y/N):")
if ans == "N":
raise(SystemExit)
elif ans == "Y":
break
...Well, before I got 9/25. That was the first try with 25 items. The technique works wonders.You scored 25/25
Actual - Yours
telephone - telephone
branch - branch
cactus - cactus
hydrant - hydrant
cellar - cellar
advice - advice
water - water
smoke - smoke
seashore - seashore
north - north
turkey - turkey
arithmetic - arithmetic
income - income
beetle - beetle
coach - coach
rifle - rifle
bomb - bomb
cattle - cattle
chocolate - chocolate
battle - battle
beast - beast
basketball - basketball
honey - honey
toothbrush - toothbrush
basket - basket
Have fun!