I'm trying to make a program in C, but it's actually the algorithm that's giving me hell.
The goal is to create a program that calculates and displays the total number of end-locations (all locations, including similar ones) an object can reach in a 2d board (grid), using a defined maximum of moves, using only pre-defined movements.
For example, if the object would start at (0,0), and the movements would be defined as:
movement1: (x+3) (y+1)
movement 2: (x+2) (y+3)
and the maximum of allowed moves would be 8. Then what would all the possible end-location coordinates be? (of the in total (2*2*2*2*2*2 = 64 moves?).
It's probably very easy, but i've been going crazy over it for a couple of hours now - and i keep on ending up with nested for-loops that just don't work out.
If anyone out here could give me a push into the right direction, it would be very much appreciated! :)
Edited 7 Years Ago by macdonald12: n/a