A certain children's game, often called "Huckle Buckle Beanstalk", is played with two players. Here is a brief description of how the game is played:
- One player is designated the "hider", and the other the "seeker".
- The seeker goes out of the room while the hider hides a small, pre-selected object, the "treasure".
- The hider then attempts to look for the object while the seeker gives them helpful hints:
- If the seeker is approaching the treasure, the hider will call out "warmer!"
- If the seeker is moving away from the treasure, the hider will call out "cooler!"
- Once the seeker finds the treasure, they announce that they have found it.
Your children want you to play this game with them, however, you are very busy answering questions on codegolf.SE instead. So, you decide to write a program to play the game with them. However, you want to use as little time as possible typing, so you try to make the program as little characters as possible.
We can define the room in which the game is played as a two dimensional toroidal square field. The coordinate
0,0 is the bottom left corner, and the coordinate
99,99 is the top right corner. The treasure is placed at some position
m are both positive integers between 0 and 99 inclusive.
Your program will obtain input from the player using its inbuilt user input function (e.g.
raw_input(), etc.) If your chosen language does not have a user input function, take input from STDIN instead. The game will work as follows:
- The program "hides" the treasure at a position
- The program prompts the seeker to input an initial searching position. The input will come in the form
yare positive integers.
- The program outputs "correct" if the initial searching position
x,yis equal to the treasure's position
n,mand terminates. Otherwise:
- The program will prompt the seeker to move. The input comes in the form
bare integers that may be negative. This represents the direction vector that the seeker is moving in (
ais the x direction and
bis the y direction).
- If the resultant position of the seeker is at the treasure, the program outputs "correct" and terminates. Otherwise:
- The program outputs "cooler" if the seeker is moving away from the treasure, or "hotter" if they are moving towards the treasure.
- Go to step 4.
The words "moving away" and "moving towards" may be ambigious. For this challenge, if the resultant position of the seeker after moving is closer to the treasure than their position before they were moving, they are moving towards the treasure. Otherwise, they are moving away. (Yes, this does mean that if the resultant and previous position are the same distance away, the program should output "cooler").
This is code golf, so shortest code wins. Ask questions if the specification is not clear.