Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ls.py
diff options
context:
space:
mode:
Diffstat (limited to 'ls.py')
-rw-r--r--ls.py90
1 files changed, 49 insertions, 41 deletions
diff --git a/ls.py b/ls.py
index 82a19da..6871e61 100644
--- a/ls.py
+++ b/ls.py
@@ -2,10 +2,6 @@ from las import listenspell
-las = listenspell()
-las.clearscreen()
-las.playsound("begin")
-
########################################################################################
def playword(wordid):
elem = las.getwordinfo(wordid, "word") #get a word from the list
@@ -35,6 +31,7 @@ def playword(wordid):
2 for Sample
3 to repete the word
4 for word length
+ * to quit
or any other key to answer"""
if reprint == True:
print string
@@ -53,8 +50,10 @@ def playword(wordid):
reprint = True
for (sample) in usage:
las.saytext(sample)
+ reprint = False
num_sample = num_sample - 1
if num_sample != 0:
+ reprint = True
print "To get another sample press 'n' or anyother key to answer"
k = las.getkey()
if k != 'n': break
@@ -63,6 +62,8 @@ def playword(wordid):
reprint = False
elif k == "4":
print "Word Length:" + str(len(elem))
+ elif k =="*":
+ las.exitgame()
else:
cluemode = False
@@ -105,44 +106,51 @@ def getskilllevel():
-gameover = False
-while gameover == False:
- levelsize = 7 # this stays constant throughout
-
- getskilllevel()
- wordidlist = las.load_wordid(levelsize + 3) # At max Three error possible
- num_words = len(wordidlist)
- las.clearscreen()
- #### MAIN LOOP
+if __name__=='__main__':
+ las = listenspell()
+ las.clearscreen()
las.playsound("begin")
-
-
- for index in range(num_words):
-
- ## print pronouncedict
- ## print pronouncedictstring
- ## print pronouncelist
- wordid = wordidlist[index]
- result = playword(wordid)
- print "Your score is " + str(las.getpoints())
-
- if result == True:
- if las.getwords_correct == 7:
- print "Very good."
- print "If you want to play game again with another level press $ or any other key to quit"
- k = las.getkey()
- if k == '$':
- break # Restart game with next level
- else:
- las.exitgame()
-
- if las.getwords_correct == 7:
- continue # Restart game with next level
- else:
- gameover = True
- las.saytext("Game Over")
- print "Game Over."
- las.exitgame()
+
+ gameover = False
+ while gameover == False:
+ levelsize = 7 # this stays constant throughout
+
+ getskilllevel()
+ wordidlist = las.load_wordid(levelsize + 3) # At max Three error possible
+ num_words = len(wordidlist)
+ las.clearscreen()
+
+ #### MAIN LOOP
+
+ las.playsound("begin")
+
+
+ for index in range(num_words):
+
+ ## print pronouncedict
+ ## print pronouncedictstring
+ ## print pronouncelist
+ wordid = wordidlist[index]
+ result = playword(wordid)
+ print "Your score is " + str(las.getpoints())
+
+ if result == True:
+ if las.getwords_correct == 7:
+ print "Very good."
+ print "If you want to play game again with another level press % or any other key to quit"
+ k = las.getkey()
+ if k == '%':
+ break # Restart game with next level
+ else:
+ las.exitgame()
+
+ if las.getwords_correct == 7:
+ continue # Restart game with next level
+ else:
+ gameover = True
+ las.saytext("Game Over")
+ print "Game Over."
+ las.exitgame()