ScratchData LogoScratchData
Back to gtoal's profile

Countdown Numbers Game with opponent

GTgtoal•Created October 19, 2014
Countdown Numbers Game with opponent
2
1
397 views
View on Scratch

Instructions

Use the numbers given and join them with + - * / to reach the randomly selected target. For example with a target of 165 and numbers of 25 50 7 6 7 8, a solution would be (6 + 8) * 7 + 50 - 7 + 25. Note each number can only be used once unless you get more than one of that number. Division is only allowed if the number divides with no remainder.

Description

GUI by WillJimbo. I've written a solver for the Numbers Game in Countdown (also played in France as "Jeu des Chiffres".) Like the resident experts in real game, it is not infallible and doesn't always find a solution before the human opponent. (It depends on how fast your computer is...) This actually makes it a pretty fair opponent, which is more fun than having an infallible computer that beats you every time. It starts computing the solution while waiting for you to come up with your solution. Since the computer isn't quite fast enough to find all solutions while the player is thinking, it's given another 15 seconds after the clock stops, if it needs it. It doesn't yet allow you to enter your solution, but if it did, it could use that time as well to finish searching for the result. (It might be worth adding a button saying that you want to wait until the computer has finished searching, so that you can find out for sure if there is a solution or not) This is just a demo harness to show the solver code, I'm hoping that WillJimbo and JamiePrez will incorporate the solver into their games. The biggest thing missing is allowing you to enter your solution, and checking it. (Remembering that if you don't type it in promptly enough, you void your play because it will assume you didn't really manage to come up with a solution in time...) The code is slowed down a little by allowing screen updates in the custom blocks that search for a solution (even though they don't display anything); but if I set that flag in the custom blocks, the sound that is being played is interfered with by the computationally intensive search for a solution. (Although the same code in C executed in about 1 second :-/ ) Also there's a bug - it finds solutions using all 6 numbers but not any using fewer numbers. For now I've disabled the code that looks for shorter solutions, to speed it up a little.

Project Details

Project ID30412456
CreatedOctober 19, 2014
Last ModifiedOctober 21, 2014
SharedOctober 20, 2014
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root