PDA

View Full Version : Stop! Hammertime.


Peter Kirby
September 19th 2005, 03:12 PM
I just solved this problem (http://acm.uva.es/p/v108/10853.html) with this solution (http://rafb.net/paste/results/1EJW8l34.html).

"Pablito will give you a birdie if you can beat him in his favorite game: nailing the nail. This game is a pretty mixture of intelligence and brute force. There is a long nail, a bit inserted into a piece of wood. You and Pablito hit the nail in turns with a hammer. The winner is the first player who completely inserts the nail."

"All measures are given in integer numbers. Depending on his/her strength and ability, each player can push the nail between a minimum, Xmin, and a maximum quantity, Xmax. However, if the current length of the nail is less than Xmin, the player can insert the nail completely and win."

My first instinct was to use a minimax algorithm. The optimal solution is not obvious. Check out the code to see what I did.

kind thoughts,
Peter Kirby

Bill the Cat
September 19th 2005, 03:27 PM
I just solved this problem (http://acm.uva.es/p/v108/10853.html) with this solution (http://rafb.net/paste/results/1EJW8l34.html).

"Pablito will give you a birdie if you can beat him in his favorite game: nailing the nail. This game is a pretty mixture of intelligence and brute force. There is a long nail, a bit inserted into a piece of wood. You and Pablito hit the nail in turns with a hammer. The winner is the first player who completely inserts the nail."

"All measures are given in integer numbers. Depending on his/her strength and ability, each player can push the nail between a minimum, Xmin, and a maximum quantity, Xmax. However, if the current length of the nail is less than Xmin, the player can insert the nail completely and win."

My first instinct was to use a minimax algorithm. The optimal solution is not obvious. Check out the code to see what I did.

kind thoughts,
Peter Kirby
:baby5:

Higon
September 19th 2005, 03:42 PM
Hammertime!

Bill the Cat
September 19th 2005, 03:45 PM
Hammertime!
:rofl:!!!!