Murga-Projects Forums

Full Version: Math Machine
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is a little math quiz program I made for my daughter. She home schools.
With pencil and paper math assignments she'll take 30 minutes for 10 problems, but with this little program she rips through 200 problems in the same time.

The program only deals with integer math and positive numbers.
The program solves division problems by first multiplying the variables, and providing the answer of the multiplication as a fraction.
It also plays switcheroo with subtraction problems to avoid negative answers.

The Options tab sets the level of difficulty of the math problems.

The program writes a record of progress to a file "MathRecords.lua", currently at the root or home directory (depending on how the program is run), you can of course change that in the code.

I've attached the Fluid file.

Code:
rndMinTop=1
rndMinBottom=1

rndMaxTop=11
rndMaxBottom=11

rndProcessOption=4

o1=math.random(rndMinTop,rndMaxTop)
o2=math.random(rndMinBottom,rndMaxBottom)
o3=math.random(1,rndProcessOption)
o4=0

answervalue=0

score={{}}
score["answer"]= {}
score["correct"]=""
score["tries"]=""

score["multiplication"]={}
score["division"]={}
score["subtraction"]={}
score["addition"]={}


mathRecords={}


local Q = '"';
local ba="{";
local bb="}";
local C=",";


score["correct"]=1
score["tries"]=1
score["addition"]={"1,1,1,2"}
score["subtraction"]={"1,1,2,0"}
score["multiplication"]={"1,1,3,1"}
score["division"]={"1,1,4,1"}
currentUnit={}
listCount = 0; --#mathList
totalwords = 0
keystrokeCount = 0
totalLetters =0
wordscompleted=0
spellingTimerStart = os.time()
TotalElapsedTime = 0
UnitElapsedTime = 0
wordsPerMinute = 0
minuteCount = 0
elapsedWordtime = 0
wpmcount = 0
unitDepth = 1
listDepth = 1
wordsPerMinute=0
-- "len": the # operation.
function len_event (op)
       if type(op) == "string" then
         return strlen(op)         -- primitive string length
       elseif type(op) == "table" then
         return #op                -- primitive table length
       else
         local h = metatable(op).__len
         if h then
           -- call the handler with the operand
           return (h(op))
         else  -- no handler available: default behavior
           error()
         end
       end
     end
function getLocations(o1,o2,o3)


--TOP
--hundredsplacebox
hptx,hpty = hundredsplaceT:x(),hundredsplaceT:y()
hptw,hpth = hundredsplaceT:w(),hundredsplaceT:h()
--tensplacebox
tptx,tpty = tensplaceT:x(),tensplaceT:y()
tptw,tpth = tensplaceT:w(),tensplaceT:h()
--onesplacebox
optx,opty = onesplaceT:x(),onesplaceT:y()
optw,opth = onesplaceT:w(),onesplaceT:h()
if o1 < 10 then
output1:resize(optx,opty,hptw,hpth)
end
if o1 >= 10 and o1 < 100 then
output1:resize(tptx,tpty ,tptw,tpth)
end
if o1 >= 100 and o1 < 1000 then
output1:resize(hptx,hpty,hptw,hpth)
end



--BOTTOM
--hundredsplacebox
hpbx,hpby = hundredsplaceB:x(),hundredsplaceB:y()
hpbw,hpbh = hundredsplaceB:w(),hundredsplaceB:h()
--tensplacebox
tpbx,tpby = tensplaceB:x(),tensplaceB:y()
tpbw,tpbh = tensplaceB:w(),tensplaceB:h()
--onesplacebox
opbx,opby = onesplaceB:x(),onesplaceB:y()
opbw,opbh = onesplaceB:w(),onesplaceB:h()
o3w,o3h = output3:w(),output3:h()
--DIVISION
--hundredsplacebox
hpdx,hpdy = hundredsplaceD:x(),hundredsplaceD:y()
hpdw,hpdh = hundredsplaceD:w(),hundredsplaceD:h()
--tensplacebox
tpdx,tpdy = tensplaceD:x(),tensplaceD:y()
tpdw,tpdh = tensplaceD:w(),tensplaceD:h()
--onesplacebox
opdx,opdy = onesplaceD:x(),onesplaceD:y()
opdw,opdh = onesplaceD:w(),onesplaceD:h()

if o2 < 10 then
output2:resize(opbx,opby,hpbw,hpbh)
output3:resize((opbx-o3w),opby,o3w,o3h)
output2b:resize(opdx,opdy,hpbw,hpdh)
end
if o2 >= 10 and o2 < 100 then
output2:resize(tpbx,tpby ,tpbw,tpbh)
output3:resize((tpbx-o3w),opby,o3w,o3h)
output2b:resize(tpdx,tpdy ,tpdw,tpdh)
end
if o2 >= 100 and o2 < 1000 then
output2:resize(hpbx,hpby,hpbw,hpbh)
output3:resize((hpbx-o3w),opby,o3w,o3h)
output2b:resize(hpdx,hpdy,hpbw,hpdh)
end
end

function listScoreForOutput(TableName)
    local Q = '"';
    local ba="{";
    local bb="}";
    local C=",";

local listout = ""
local scoreword={}
local wordlist=""
        for i = 1,#score[TableName],1 do
        scoreword=score[TableName][i]    
        
            qfind = string.find(scoreword,Q)
            if qfind == nil then
            scoreword=Q..scoreword..Q
            end
        
        
        listout = listout..scoreword..C
        end
        
         scoreout="\n".."score["..Q..TableName..Q.."]="..ba..string.sub(listout,1,-2)..bb;
    
    return scoreout    
end
function updateMaxMin()
rndMinTop=mincountertop:value()
rndMinBottom=mincounterbottom:value()
rndMaxTop=maxcountertop:value()
rndMaxBottom=maxcounterbottom:value()
return rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom
end
function updateProcessOptions()

end
function updateProgressValues()
currentcorrect = score["correct"]
currenttries = score["tries"]

daybar:value(dailypercent)
daybar:label(dailypercent.." today")

dailypercentupvalue=( currentcorrect / currenttries )*100
correctbar:value(dailypercentupvalue)
correctbar:label("Proficiency: "..dailypercentupvalue)

monthlypercent=(currentcorrect)/200
yearlypercent=(currentcorrect)/1720
currentpercent=((currentcorrect)/10)*100

--output4:value(currentcorrect)
--output5:value(currenttries)


yearbar:value((1720-currentcorrect))
yearbar:label(currentcorrect.." of 1720")

sc=score["correct"]
st=score["tries"]
MathWindow:label(sc.." correct of "..st.." tries".." | Proficiency:"..dailypercentupvalue.." | 1720")

end
function openMathRecords()
listFile="mathRecord.lua"
    local sl=io.open(listFile,"r*")
    if sl~=nil then
    dofile(listFile)
    sl:close()
    end
    return score["correct"]    
end
function openCurrentMathProgress()
wordlistdepthfile = "CurrentMathProgress.txt"
myFile = io.open(wordlistdepthfile,"r")
if myFile ~= nil then
dofile(wordlistdepthfile)
myFile:close()
end
end
function WriteMathListsToFile()
mathListsFile = "mathRecord.lua"
    local f = io.open(mathListsFile,"w")
    local Q = '"';
    local ba="{";
    local bb="}";
    local C=",";

    if f ~= nil then
    
        
    
        
        
        correct=score["correct"]
        tries=score["tries"]
        


    listwrite="\n"
        listwrite = listwrite.."\n"..listScoreForOutput("addition")
        listwrite = listwrite.."\n"..listScoreForOutput("subtraction")
        listwrite = listwrite.."\n"..listScoreForOutput("multiplication")
        listwrite = listwrite.."\n"..listScoreForOutput("division")
        
        
            
        
        listwrite = listwrite.."\n".."score["..Q.."correct"..Q.."]="..correct..";\n";
        listwrite = listwrite.."\n".."score["..Q.."tries"..Q.."]="..tries..";\n";
        
        f:write(listwrite)
        f:write(string.char (10))
        io.close(f)
    end
    
    
    
    
    
end
function progressdaily()
progbar:minimum(0)
progbar:maximum(100)
end
function randomize()
o1=math.random(rndMinTop,rndMaxTop)
o2=math.random(rndMinBottom,rndMaxBottom)


o3=math.random(1,rndProcessOption)


o4=0
return o1,o2,o3
end
function answerproblem(o1,o2,o3,answervalue)


mathsigns={"+","-","/","*","^"}

-- addition
if o3 == 1 then answervalue = o1 + o2 end

-- multiplication
if o3 == 4 then answervalue = o1 * o2 end

-- handle subtraction without negative values
if o3 == 2 then
    if o1 < o2 then
        hold1 = o1
        ol = o2
        o2 = hold1
    end
    answervalue = o1 - o2
end

-- handle fractions as divisions
    if o3 == 3 then  
    subtotal = o1 * o2
    answervalue = o1
    o1=subtotal
    fractionbar:show()
    divisiongroup:show()
    output3:label("Divide")
    output2b:value(o2)
    output1b:value(o1)
    output2c:value(o2)
    output1c:value(o1)
    else
    divisiongroup:hide()
    output3:label(" ")
    fractionbar:hide()
    end
    
output1:value(o1)
output2:value(o2)
output3:value(mathsigns[o3])



getLocations(o1,o2,o3)

answeroutput:value(answervalue)
alloutputs = o1..","..o2..","..o3..","..answervalue

return o1,o2,o3,answervalue
end
function checkanswer(w)
local tried=score["tries"]

if AnswerCheck:value() ~= nil then
alloutputs = Q..o1..output3:value()..o2.."="..answeroutput:value()..Q
tried=tried+1
score["tries"]=tried

end

alloutputs = Q..o1..","..o2..","..o3..","..answeroutput:value()..Q

--if the entered value equals correct answer
if w:value() == answeroutput:value() then
dailypercent=dailypercent +1
score["correct"]=score["correct"]+1    


    if o3 == 1 then
    alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q
    table.insert(score["addition"], alloutputs)
    end

    if o3 == 2 then
    alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q
    table.insert(score["subtraction"], alloutputs)
    end

    if o3 == 3 then
    alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q
    table.insert(score["multiplication"], alloutputs)
    end

    if o3 == 4 then
    alloutputs = Q..o1..","..o2..","..answeroutput:value()..Q
    table.insert(score["division"], alloutputs)
    end



rndMinTop,rndMinBottom,rndMaxTop,rndMaxBottom=updateMaxMin()
o1,o2,o3,answervalue = answerproblem(randomize(rndMinTop,rndMaxBottom,4))
w:value("")
save()
end

updateProgressValues()


MathWindow:redraw()
MathWindow:make_current()
end
function cycleproblems()


o1,o2,o3,answervalue = answerproblem(randomize(rndMaxTop,rndMaxBottom,rndProcessOption))


MathWindow:redraw()
MathWindow:make_current()
end
function save()
WriteMathListsToFile()
end
if MathWindow ~= nil then MathWindow:hide() end
do MathWindow= fltk:Fl_Double_Window(0,0,0,0,"")
MathWindow:resize(63,50,965,721)
MathWindow:color(0)
--MathWindow:show()
do HiddenGroup= fltk:Fl_Group(0,0,0,0,"")
HiddenGroup:resize(15,5,1410,630)
--unknown attribute: hide
--unknown attribute: deactivate
do output6= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "=")
output6:label(gLabelTable[#gLabelTable])
output6:resize(1105,14,150,17)
output6:color(31)
output6:labelsize(12)
output6:labelcolor(7)
output6:align(36)
output6:textcolor(7)
end

do NextButton= fltk:Fl_Button(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "NEXT")
NextButton:label(gLabelTable[#gLabelTable])
NextButton:callback(cycleproblems)
NextButton:resize(1270,15,60,15)
NextButton:labelsize(12)
end

do Save= fltk:Fl_Button(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Save")
Save:label(gLabelTable[#gLabelTable])
Save:callback(save)
Save:resize(1335,15,60,15)
--unknown attribute: deactivate
end

do output4= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Correct of:")
output4:label(gLabelTable[#gLabelTable])
output4:resize(15,616,25,19)
output4:box(fltk.FL_NO_BOX)
output4:color(31)
output4:labelsize(10)
output4:labelcolor(62)
output4:align(40)
output4:textsize(10)
output4:textcolor(62)
end

do output5= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Tries")
output5:label(gLabelTable[#gLabelTable])
output5:resize(90,616,25,19)
output5:box(fltk.FL_NO_BOX)
output5:color(31)
output5:labelsize(10)
output5:labelcolor(62)
output5:align(40)
output5:textsize(10)
output5:textcolor(62)
end
Fl_Group:current(Fl_Group:current():parent())
end

do NumPositionGroup= fltk:Fl_Group(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "NumPositionGroup")
NumPositionGroup:label(gLabelTable[#gLabelTable])
NumPositionGroup:resize(173,108,459,424)

do onesplaceT= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "onesplace")
onesplaceT:label(gLabelTable[#gLabelTable])
onesplaceT:resize(525,116,72,89)
onesplaceT:box(fltk.FL_UP_FRAME)
onesplaceT:color(6)
end

do tensplaceT= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "tensplace")
tensplaceT:label(gLabelTable[#gLabelTable])
tensplaceT:resize(465,116,132,89)
tensplaceT:box(fltk.FL_UP_FRAME)
tensplaceT:color(6)
end

do hundredsplaceT= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "hundredsplaceT")
hundredsplaceT:label(gLabelTable[#gLabelTable])
hundredsplaceT:resize(407,116,190,89)
hundredsplaceT:box(fltk.FL_THIN_UP_FRAME)
hundredsplaceT:color(6)
end

do onesplaceB= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "onesplace")
onesplaceB:label(gLabelTable[#gLabelTable])
onesplaceB:resize(525,211,72,89)
onesplaceB:box(fltk.FL_UP_FRAME)
onesplaceB:color(6)
end

do tensplaceB= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "tensplace")
tensplaceB:label(gLabelTable[#gLabelTable])
tensplaceB:resize(465,211,132,89)
tensplaceB:box(fltk.FL_UP_FRAME)
tensplaceB:color(6)
end

do hundredsplaceB= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "hundredsplaceT")
hundredsplaceB:label(gLabelTable[#gLabelTable])
hundredsplaceB:resize(407,211,190,89)
hundredsplaceB:box(fltk.FL_THIN_UP_FRAME)
hundredsplaceB:color(6)
end

do hundredsplaceD= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "hundredsplaceT")
hundredsplaceD:label(gLabelTable[#gLabelTable])
hundredsplaceD:resize(193,432,160,81)
hundredsplaceD:box(fltk.FL_THIN_UP_FRAME)
hundredsplaceD:color(6)
end

do tensplaceD= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "tensplace")
tensplaceD:label(gLabelTable[#gLabelTable])
tensplaceD:resize(243,432,110,81)
tensplaceD:box(fltk.FL_UP_FRAME)
tensplaceD:color(6)
end

do onesplaceD= fltk:Fl_Box(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "onesplace")
onesplaceD:label(gLabelTable[#gLabelTable])
onesplaceD:resize(293,432,60,81)
onesplaceD:box(fltk.FL_UP_FRAME)
onesplaceD:color(6)
end
Fl_Group:current(Fl_Group:current():parent())
end

do MathTab= fltk:Fl_Tabs(0,0,0,0,"")
MathTab:resize(0,4,1515,851)
MathTab:box(fltk.FL_GTK_UP_BOX)
MathTab:color(0)
MathTab:selection_color(34)
do MathGroup= fltk:Fl_Group(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Math")
MathGroup:label(gLabelTable[#gLabelTable])
MathGroup:resize(1,33,1481,822)
MathGroup:box(fltk.FL_GTK_UP_BOX)
MathGroup:color(33)
MathGroup:labelsize(11)
MathGroup:labelcolor(59)
MathGroup:when(0)
do divisiongroup= fltk:Fl_Group(0,0,0,0,"")
divisiongroup:resize(186,164,554,666)
divisiongroup:labelcolor(1)
do output1b= fltk:Fl_Output(0,0,0,0,"")
output1b:resize(398,433,208,82)
output1b:box(fltk.FL_NO_BOX)
output1b:labelsize(100)
output1b:labelcolor(80)
output1b:textfont(1)
output1b:textsize(90)
output1b:textcolor(60)
end

do output2b= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "=")
output2b:label(gLabelTable[#gLabelTable])
output2b:resize(211,433,160,73)
output2b:box(fltk.FL_NO_BOX)
output2b:labelsize(40)
output2b:labelcolor(59)
output2b:textfont(1)
output2b:textsize(90)
output2b:textcolor(60)
end

do equalsbar1= fltk:Fl_Button(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "button")
equalsbar1:label(gLabelTable[#gLabelTable])
equalsbar1:resize(365,426,274,5)
equalsbar1:box(fltk.FL_FLAT_BOX)
equalsbar1:color(1)
equalsbar1:selection_color(0)
equalsbar1:labeltype(fltk.FL_NO_LABEL)
end

do fractionbar= fltk:Fl_Button(0,0,0,0,"")
fractionbar:resize(408,201,216,5)
fractionbar:box(fltk.FL_FLAT_BOX)
fractionbar:color(1)
fractionbar:selection_color(0)
fractionbar:labeltype(fltk.FL_NO_LABEL)
fractionbar:align(4)
end

do output2c= fltk:Fl_Output(0,0,0,0,"")
output2c:resize(186,802,40,28)
output2c:box(fltk.FL_NO_BOX)
output2c:labelsize(16)
output2c:labelcolor(59)
output2c:textfont(1)
output2c:textsize(16)
output2c:textcolor(181)
end

do output1c= fltk:Fl_Output(0,0,0,0,"")
output1c:resize(186,777,40,30)
output1c:box(fltk.FL_NO_BOX)
output1c:labelsize(16)
output1c:labelcolor(59)
output1c:textfont(1)
output1c:textsize(16)
output1c:textcolor(181)
end

do divisionlabel= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, ")")
divisionlabel:label(gLabelTable[#gLabelTable])
divisionlabel:resize(398,423,8,82)
divisionlabel:box(fltk.FL_NO_BOX)
divisionlabel:labelsize(100)
divisionlabel:labelcolor(80)
divisionlabel:textfont(1)
divisionlabel:textsize(90)
divisionlabel:textcolor(60)
end
Fl_Group:current(Fl_Group:current():parent())
end

do answeroutput= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Answer:")
answeroutput:label(gLabelTable[#gLabelTable])
answeroutput:resize(1,324,561,24)
end

do output1= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "output1:")
output1:label(gLabelTable[#gLabelTable])
output1:resize(421,112,191,88)
output1:box(fltk.FL_NO_BOX)
output1:labelfont(1)
output1:labelsize(10)
output1:labelcolor(59)
output1:align(5)
output1:textfont(1)
output1:textsize(100)
output1:textcolor(60)
end

do output2= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "output2:")
output2:label(gLabelTable[#gLabelTable])
output2:resize(421,207,190,88)
output2:box(fltk.FL_NO_BOX)
output2:labelfont(1)
output2:labelsize(10)
output2:labelcolor(59)
output2:align(5)
output2:textfont(1)
output2:textsize(100)
output2:textcolor(60)
end

do output3= fltk:Fl_Output(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "output3:")
output3:label(gLabelTable[#gLabelTable])
output3:resize(340,208,81,92)
output3:box(fltk.FL_NO_BOX)
output3:labelsize(10)
output3:labelcolor(59)
output3:textsize(120)
output3:textcolor(61)
end

do solutionbar= fltk:Fl_Button(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "button")
solutionbar:label(gLabelTable[#gLabelTable])
solutionbar:resize(361,298,255,7)
solutionbar:box(fltk.FL_FLAT_BOX)
solutionbar:color(218)
solutionbar:selection_color(0)
solutionbar:labeltype(fltk.FL_NO_LABEL)
end

do AnswerCheck= fltk:Fl_Input(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "=")
AnswerCheck:label(gLabelTable[#gLabelTable])
AnswerCheck:callback(checkanswer)
AnswerCheck:resize(400,308,215,113)
AnswerCheck:box(fltk.FL_FLAT_BOX)
AnswerCheck:color(35)
AnswerCheck:labelsize(40)
AnswerCheck:labelcolor(59)
AnswerCheck:when(8)
AnswerCheck:textfont(1)
AnswerCheck:textsize(100)
AnswerCheck:textcolor(61)
end

do StatusGroup= fltk:Fl_Group(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Status")
StatusGroup:label(gLabelTable[#gLabelTable])
StatusGroup:resize(10,604,942,113)
StatusGroup:labelsize(11)
do daybar= fltk:Fl_Progress(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Daily: 10 Correct")
daybar:label(gLabelTable[#gLabelTable])
daybar:resize(10,667,942,16)
daybar:box(fltk.FL_FLAT_BOX)
daybar:color(32)
daybar:selection_color(34)
daybar:labelsize(10)
daybar:labelcolor(2)
daybar:align(20)
end

do yearbar= fltk:Fl_Progress(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Year:  1720 Correct")
yearbar:label(gLabelTable[#gLabelTable])
yearbar:resize(10,684,942,16)
yearbar:box(fltk.FL_FLAT_BOX)
yearbar:color(32)
yearbar:selection_color(34)
yearbar:labelsize(10)
yearbar:labelcolor(2)
yearbar:align(20)
end

do correctbar= fltk:Fl_Progress(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Proficiency")
correctbar:label(gLabelTable[#gLabelTable])
correctbar:resize(10,701,942,16)
correctbar:box(fltk.FL_FLAT_BOX)
correctbar:color(57)
correctbar:selection_color(34)
correctbar:labelsize(10)
correctbar:labelcolor(2)
correctbar:align(20)
end
Fl_Group:current(Fl_Group:current():parent())
end
Fl_Group:current(Fl_Group:current():parent())
end

do optionsgroup= fltk:Fl_Group(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Options")
optionsgroup:label(gLabelTable[#gLabelTable])
optionsgroup:resize(21,30,1440,805)
optionsgroup:box(fltk.FL_GTK_UP_BOX)
optionsgroup:color(32)
optionsgroup:labelsize(10)

do mincountertop= fltk:Fl_Value_Input(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Top number minimum:")
mincountertop:label(gLabelTable[#gLabelTable])
mincountertop:callback(updateMaxMin)
mincountertop:resize(486,246,95,24)
mincountertop:labelfont(1)
mincountertop:labelsize(12)
mincountertop:labelcolor(221)
mincountertop:minimum(1)
mincountertop:maximum(99)
mincountertop:step(1)
mincountertop:value(1)
end

do maxcounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Bottom number maximum:")
maxcounterbottom:label(gLabelTable[#gLabelTable])
maxcounterbottom:callback(updateMaxMin)
maxcounterbottom:resize(486,333,95,24)
maxcounterbottom:labelfont(1)
maxcounterbottom:labelsize(12)
maxcounterbottom:labelcolor(221)
maxcounterbottom:minimum(1)
maxcounterbottom:maximum(100)
maxcounterbottom:step(1)
maxcounterbottom:value(10)
end

do mincounterbottom= fltk:Fl_Value_Input(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Bottom number minimum:")
mincounterbottom:label(gLabelTable[#gLabelTable])
mincounterbottom:callback(updateMaxMin)
mincounterbottom:resize(486,376,95,24)
mincounterbottom:labelfont(1)
mincounterbottom:labelsize(12)
mincounterbottom:labelcolor(221)
mincounterbottom:minimum(1)
mincounterbottom:maximum(99)
mincounterbottom:step(1)
mincounterbottom:value(1)
end

do maxcountertop= fltk:Fl_Value_Input(0,0,0,0,"")
if gLabelTable==nil then gLabelTable={} end
table.insert(gLabelTable, "Top number maximum:")
maxcountertop:label(gLabelTable[#gLabelTable])
maxcountertop:callback(updateMaxMin)
maxcountertop:resize(486,286,95,24)
maxcountertop:labelfont(1)
maxcountertop:labelsize(12)
maxcountertop:labelcolor(221)
maxcountertop:minimum(1)
maxcountertop:maximum(100)
maxcountertop:step(1)
maxcountertop:value(10)
end
Fl_Group:current(Fl_Group:current():parent())
end
end
end
MathWindow:show()

MathWindow:label("MATH MACHINE")
MathWindow:show()

dailypercent=0

answeroutput:hide()
maxcounterbottom:value(rndMaxBottom)
maxcountertop:value(rndMaxTop)

daybar:minimum(0)
daybar:maximum(20)
daybar:value(0)
yearbar:minimum(0)
yearbar:maximum(1720)
correctbar:minimum(0)
correctbar:maximum(101)

output1:label(" ")
output2:label(" ")
output3:label(" ")
output4:label(" ")
output5:label(" ")
output6:label(" ")

-- open mathRecord.lua get score["correct"] & score["tries"] data
openMathRecords()
score["correct"]=(#score["addition"])+(#score["subtraction"])+(#score["multiplication"])+(#score["division"])
cycleproblems()

output5:value(score["tries"])
output4:value(score["correct"])

Fl:scheme("plastic")
MathWindow:redraw()
MathWindow:make_current()

Fl:run()

Reference URL's