How to generate different equations for a previously defined result?

0 favourites
  • 2 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I need to generate 4 equations using different operators but only one of them (and in some cases none) will correspond to a previously randomly selected result.

    For example: the system defines 22 as the result and then creates 4 equations spread across the screen, one of which is correct (11+11) and the other 3 are not, but have close results (42-21 or 12*2) or use the same numbers with another operator: (11 /11)

    How to make the system generate these equations automatically, based on the value defined as a result?

    Thanks for any help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Easiest would be to just manually come up with a list of equations. Make enough and it should work.

    Other ideas could be to randomly gen two numbers and an operator repeatedly. It’s kind of shooting in the dark idea. You’d keep trying combinations till you get a result close enough. You’d probably want to discard any results that aren’t integers too.

    To make it work faster you could take the result and change it by a small amount, generate one number and use some algebra to calculate the other.

    Another idea is to make a big list of all numbers in a range combined together with each operator. We’d throw out all the non integer results and then sort the whole list by the result. Then to use you’d pick a random one from the list then jump a random amount away to another index for the other equations.

    Anyways just some random ideas. No pun intended. Maybe some of it could give you a possible approach to try.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)