# Algorithm Ideas?

1. Apr 8, 2009

### shawshank

Ok, we have this project where we have to code this game:

The point of the game is to place numbers in empty boxes in a 2D array of numbers such that the the 8 surrounding positions when added have the number in the middle as the last digit of the sum.
Here is an example:
1 2 3
4 4
5 5 4

the sum of those numbers is 1+2+3+4+4+5+5+4=28. Since 8 is the last digit of 28, then putting an eight in the middle would make all boxes around it become empty. Anything else and the number is just placed in the empty box (for example if u put 7 there).

Also, you have a que of numbers which is equal to the number of rows of the board.

So far as an algorithm we have, find a spot that will cause numbers to cancel (trivial obvious step) and then try to find the position in which more numbers get canceled. If the current number in the que cannot be placed somewhere to cancel anything, then look at the next number in the que and try to place current number to cancel that value.
The program has to be written in C and libraries are allowed, any ideas would be welcome.

Last edited: Apr 8, 2009