Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data.py
diff options
context:
space:
mode:
Diffstat (limited to 'data.py')
-rw-r--r--data.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/data.py b/data.py
index 2bd91e9..f799fd4 100644
--- a/data.py
+++ b/data.py
@@ -1,7 +1,7 @@
"""
Copyright (C) 2009 Mike Major <ossfm@yahoo.com>
- This file is part of HopAround.
+ This file is part of Hop-A-Round.
Hop-A-Round is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Hop-A-Round. If not, see <http://www.gnu.org/licenses/>.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import random
@@ -24,18 +24,22 @@ class LevelData():
def __init__(self):
self.question_max = 3 # number of questions in each section (slider, multiple choice & entry)
self.thresh_slider = 0 # if question count matches this number, change to this section
- self.thresh_mult = self.question_max # if question count matches this number, change to this section
- self.thresh_entry = 2 * self.question_max # if question count matches this number, change to this section
self.min_level = 1 # minimum levels in the activity; also the exponent of the current level
self.max_level = 5 # maximum levels in the activity; also the exponent of the current level
self.current_level = 1 # starting and current level indicator
- self.question_count = 0 # number of questions asked on current level
- self.level_score = 0 # number of questions correct on current level
- self.thresh_up = 6 # level score at/above which the level will be increased
self.thresh_down = 0 # level score at/below which the level will be reduced
self.level_change = 0 # flag indicating a level change
self.digits = [] # collection of digits to create the question from
+ self.set_question_count(self.question_max)
random.seed()
+
+ def set_question_count(self, max):
+ self.question_max = max
+ self.thresh_mult = self.question_max # if question count matches this number, change to this section
+ self.thresh_entry = self.question_max * 2 # if question count matches this number, change to this section
+ self.thresh_up = self.question_max * 3 # level score at/above which the level will be increased
+ self.question_count = 0 # number of questions asked on current level
+ self.level_score = 0 # number of questions correct on current level
def check_answer(self, response):
if response == self.correct_answer:
@@ -91,14 +95,14 @@ class LevelData():
else:
factor = random.choice([0.1,10.0])
self.mult.append(int(math.floor(self.random_number/(self.answer_decade*factor)) * self.answer_decade * factor))
- self.mult.append(int(math.ceil(self.random_number/(self.answer_decade*factor)) * self.answer_decade * factor))
+ self.mult.append(int(math.ceil(self.random_number/(self.answer_decade*factor)) * self.answer_decade * factor))
def get_game_data(self):
- temp = "\n\nLevel: " + str(self.current_level)
+ temp = "Level: " + str(self.current_level)
#temp += "\nRandom Number: " + str(self.random_number)
#temp += "\nDecade: " + str(self.answer_decade)
#temp += "\nCorrect Answer: " + str(self.correct_answer)
- #temp += "\nMult Choices: " + str(self.mult)
+ temp += "\nQuestion max: " + str(self.question_max)
temp += "\nScore: " + str(self.level_score)
temp += "\nCount: " + str(self.question_count)
return temp