No announcement yet.

Small math game

  • Filter
  • Time
  • Show
Clear All
new posts

  • Small math game

    hi all,
    i posted a simple math game. you must enter 6 numbers (range 1-100) and
    a target number (range say 100-2000).
    the mission is to calculate the target number, using the 6
    numbers (or less) and using the math operators +,-,*,/.
    needless to say that this little program does that for you..
    an example:
    numbers: 1 2 3 4 5 10 target number: 100
    a possible solution is: (((2*4)*(3+10))-(5-1)) = 100
    i know there are too many brackets shown but that's the way the
    program generates them and it is not mathematically wrong.
    by the way, this program uses all 6 numbers...

    in stead of coming up with a complicated algorithm (which probably would
    not be efficient...) i did it the quick and dirty way: generating random
    combinations and checking to see how close they come to the desired result.
    i was amazed to see how quickly the program comes up with a solution, atleast
    if one exists...that's powerbasic for ya!
    wrote it just for fun...
    kind regards

    [email protected]

    [this message has been edited by eddy van esch (edited september 13, 2001).]

  • #2
    Eddy, ***Very creative concept***, I liked it. Thanks, B