9 Replies Latest reply on May 10, 2014 12:41 AM by badmash

# Add em up game algorithm challange

Ok, we have this project where we have to code this game (classic mode):

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 queue of randomly generated numbers...see the above link for the gameplay of the game.

So far i have programmed it for interactive play, so the user can put the correct number in the empty spot and the surrounding numbers will disappear.

What i am having trouble with is the computer play. The computer has to automatically solve the game. I just need a starting guide as to how to come up with this algorithm, programming is not an issue..just this STUPID ALGORITHM!! pulling my hair over it..

Any ideas where to begin? i am trying to do the old paper pencil method in coming up with the optimal method to solve the game..but every time I come up with something I find out that it would not work for other numbers (the numbers are randomly generated)...ANY ANY ANY help would be appreciated. Thanks.

• ###### 1. Re: Add em up game algorithm challange

Sorry, I'd have to do the same as you've been doing: pencil and paper and think think think. I'm not going to do that, the part you're trying to skip out on right now is the most important learning phase of this project. I suggest you take a break and let the problem go for a while. I'm sure the next time you're on the toilet an idea will pop into your head. That's the way it goes in the wonderful world of programming - its not about being able to come up with solutions on the spot, its about managing frustration when you're stuck.

The last thing you want to be doing is tossing in the towel, going to a forum and have yourself told how you should have done it yourself - you'll never have a good feeling about finishing this project then. Please, do everything in your (will) power to crack this one yourself.

• ###### 2. Re: Add em up game algorithm challange

gimbal2...how did you manage to crack the algorithm? can you give me some tips? i think i am approaching it the wrong way (work ethic)...so here is what i am doing:

paper pencil: drew the grid on the paper, numbered the coordinates, now i am trying to create a formula that will relate the queue numbers to the grid...so first, I need to get the coordinates of all the empty boxes (easy)...then i need to select the first empty space and see if the queue number will fit there...if not then move on to next empty space...if the queue number fits there (the surrounding numbers will disappear) ..then i need to get the coordinates of the empty cells again since the number of empty cells changed..and basically repeat this process...

but the problem arises when a number doesn't fit in any empty space...then i need to get a number from the queue such that this number when placed in a empty space will create an opportunity for the next number in queue to fit in another empty cell close by....that is the part i am struggling with...

The project is due next week, but I don't really care, i mean i can get over 60 percent with what i have at the moment, according to my TA.

But i need to solve this in my lifetime or I will go insane!!!!

TIME TO VISIT THE THINKING PAD! (THE TOILET)

• ###### 3. Re: Add em up game algorithm challange

And the first half of your post just HAPPENS to be about 100% IDENTICAL to this post from almost 5 years ago?

http://forums.iransportspress.com/archive/index.php/t-56646.html

shawshank 09-04-2009, 05:21 PM

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.

• ###### 4. Re: Add em up game algorithm challange

Yea, I was searching Google and came across that post, this person got the same project as me. So I just copied the project description from there...too lazy to type lol.

• ###### 5. Re: Add em up game algorithm challange

and THAT is your job, to "crack the algorithm".

• ###### 6. Re: Add em up game algorithm challange

jwenting wrote:

and THAT is your job, to "crack the algorithm".

It is? I thought we were getting paid to drink coffee, make crude jokes and hang around in forums all day?

• ###### 7. Re: Add em up game algorithm challange

so that's why you're so chipper all day!

They never told me anything about getting paid for this...

• ###### 8. Re: Add em up game algorithm challange

if you're too lazy to type, why should we not be too lazy to do your homework for you?

• ###### 9. Re: Add em up game algorithm challange

jwenting, it was just a project description I copied because it is the same project that person had, defeats the purpose of me writing down a brand new description.

All I was asking for was a guidance into HOW to crack the algorithm, as I though I was approaching it wrong. Nevertheless, i got it to solve the puzzle, now I am working on to find the optimal solution. Thanks for your USELESS comment about NOTHING.