I want to develop game that generates random simple math equations.
- easy –
4+5,5-6(operator used are +,-) - medium –
4*5,5/6(operator used are +,-,*,/) - difficult –
4*5/7,5/6-5(operator used are +,-,*,/)
Now I think this can be done simply generating every character randome, i.e. generate two random numbers and then generate a random operator and using them together and keeping conditions to find answer which will also check answer entered by user.
But that would be too rookie to code I guess. I want to know if this is the right way or if I should use any pre-defined math library available for PHP. As of now I have to just work with 4 operators but in future it is possible that I need to implement more complex equations.
Also, I have to implement multiplayer mode and I am thinking to use Comet so that users can play at same time together.
Should I be using PHP and MySQL to create this game or shall I create this using AJAX/JQuery?
Make a array of operators, and generate the operands random;