SO. I entirely forgot, until 9:30 this morning, that I had a dentist's appointment at 10:30! But that's over now, and I'm home again. Sooo... breakfast, then code until 2, then work until 5, then more code. x_x
It wouldn't be so... daunting... if I just had any clue about what kind of algorithm to use. Or if I had more than friggin' 10 registers
(
Read more... )
Comments 4
As for why it had to be assembly: Your professor hates you :D
Reply
I know all the syntax, how to code it, etc. It's how to solve it that's mostly bugging me.
It's a Tents puzzle and we're given the size of the grid, how many tents and how many per row/coulmn, and where the trees are, and we have to make the programsolve the puzzle. It's the algorithm to do so that's got me so confused, mostly, and partly how to implement it in Assembly x_x;
Reply
EDIT: Hmm, the first condition isn't necessary. I tried one of the later puzzles.
EDIT2: Yep, seems like my guess was correct. In pseudocode, naively:
Given a tree and the partial map:
If the tree is the null tree:
Return #tents/row = #tents/row and #tents/col = #tents/col
Else:
For direction in north/south/east/west:
If that square is empty and has no adjacent tent:
Place tent in square.
Recurse with next tree in list.
If returned OK:
Return OK.
Else:
Remove tent from square.
Return not OK.
EDIT3: Whoops, formatting error!
Reply
Reply
Leave a comment