Skip to content

Instantly share code, notes, and snippets.

@mbarton
Created November 3, 2014 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbarton/b1c7fafb00c3a98c4a1b to your computer and use it in GitHub Desktop.
Save mbarton/b1c7fafb00c3a98c4a1b to your computer and use it in GitHub Desktop.
mbarton@itrspc170:~/scratch/countdown_game$ python countdown_numbers.py -c 2 4
numbers are [1, 4, 25, 50, 75, 100]
target is 410
100 [ INITIAL_STATE ]
400 [ 4 * 100 = 400 ]
404 [ 4 * 100 = 400, 1 + 400 = 401, 75 / 25 = 3, 3 + 401 = 404 ]
405 [ 4 * 100 = 400, 50 + 75 = 125, 125 / 25 = 5, 5 + 400 = 405 ]
409 [ 50 + 75 = 125, 1 + 100 = 101, 4 * 101 = 404, 125 / 25 = 5, 5 + 404 = 409 ]
408 [ 50 / 25 = 2, 2 + 100 = 102, 4 * 102 = 408 ]
Solution not found. Best was 408.
@Dunes
Copy link

Dunes commented Nov 3, 2014

Damn, I really need to write some unittests. The program is riddled with bugs.

410 [ 100 / 50 = 2, 2 + 75 = 77, 1 + 4 = 5, 5 * 77 = 385, 25 + 385 = 410 ]
Solution found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment