This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
The_Cat's profile picture

Maths!

Started by The_Cat, 19 September 2015 - 11:31 AM
The_Cat #1
Posted 19 September 2015 - 01:31 PM
Hi,

So I made this mini maths program for people to practice. (It's a game if you enjoy maths :D/>)
Basicly generates random questions for you to try and answer.
Features:
  • Pick the amount of questions you want (up to 40)
  • Pick what operators you want (+, -, *, /)
  • Review through you're answers
Known Bugs (Haven't got round to fixing):
  • Disabling all the operators leads to blank screen (or breaks)
  • Leaving Just the division operator wont load (Thanks to Bomb Bloke)
I kinda rushed the end art of the program (reviewing questions) as I am going to uni and wanted to get it out before I left as I will be really busy.
I will try to update as I have more ideas on what to add. (Probably wont be any time soon)
(PS: The divide operator can be enabled but would not recommend as have not figured out the logic for it i.e. really hard to solve)
Here is the pastebin 7j3q4qlp
Here are some images




Edited on 22 September 2015 - 05:11 PM
Bomb Bloke #2
Posted 19 September 2015 - 11:57 PM
Your "generating" text is displayed while the script sits there wasting time. That's annoying, especially since you've got a "321 start!"-type loop immediately after it. Other than that, the presentation is pretty good.

The division code seems to be entirely non-functional. If enabled, no related questions are asked. If division is the only symbol enabled, the script goes into an infinite loop and gets killed for failing to yield.

Questions should be fairly easy to generate - pick two random numbers between eg 1 to 10, multiply them together, then discard one of the random numbers and use the two remaining to form the question.
CaosTECH #3
Posted 20 September 2015 - 05:16 AM
Whenever the game starts, it says 3-2-1-GO, but.. then just sits there, doing nothing.
The_Cat #4
Posted 22 September 2015 - 07:13 PM
Your "generating" text is displayed while the script sits there wasting time. That's annoying, especially since you've got a "321 start!"-type loop immediately after it. Other than that, the presentation is pretty good.

The division code seems to be entirely non-functional. If enabled, no related questions are asked. If division is the only symbol enabled, the script goes into an infinite loop and gets killed for failing to yield.

Questions should be fairly easy to generate - pick two random numbers between eg 1 to 10, multiply them together, then discard one of the random numbers and use the two remaining to form the question.
Will remove that then or make a short loading bar or somthing.
Didn't know the division wasn't working at all (Will Change)
Thats a neat way to gen the division will give it ago

Thanks for the feedback, will try to update the program when ever i get the time.

Whenever the game starts, it says 3-2-1-GO, but.. then just sits there, doing nothing.

Is it when you just have the division toggled on? Try leaving it off as it seems to not be working atm.
CaosTECH #5
Posted 24 September 2015 - 01:23 AM
No, I was doing addition
moomoomoo3O9 #6
Posted 29 November 2015 - 06:18 PM
Here's a hint on how I'd implement the division operator for this:
  1. Generate two random numbers for it where the first is several times larger than the second (I.E. the range on the first should be 10-100, the second 1-10)
  2. check if firstnumber%secondnumber==0 (If when you divide the first number by the second number, it has no remainder)
  3. If so, use that for the problem. If not, go back to step 1.

In actual code:

local rand1,rand2 --Yay, locals!
repeat
  rand1,rand2=math.random(1,10),math.random(10,100)
until rand1%rand2==0
Edited on 29 November 2015 - 05:26 PM
Pyuu #7
Posted 19 November 2016 - 02:22 AM
Hey, can you make this game have Derivatives and calculus.
Thanks.
Emma #8
Posted 25 November 2016 - 04:11 AM
That's kind of difficult because many times in calculus there isn't one specific answer, there are a plethora of things it could be. There are ways to do this, using CASs and such, but its not really feasible to do this within lua :P/>