Easter Egg Hunt
Bot find egg before bunny find egg. Bot happy.
Overview
This is a king-of-the-hill challenge in honor of Easter and the Easter egg hunting tradition!
Your bot has a vision of two spaces in every direction, including diagonals, creating a 5x5 square around you that you can see. It is looking for eggs, and whoever finds the most eggs wins!
The Board
The board will consist of o
s, which are Easter eggs, #
s, which are walls, *
s, which are other players, and s, which are empty spaces.
- It will be a square with edge length
(number of entries) * 3
. - It will be surrounded by walls.
- Inside of the walls will be an assortment of randomly placed, straight line walls of
#
, which will have a random length between 2 and 10 inclusive. There will be(number of entries) * 3
of them. - The eggs will then be placed randomly. There will be
(number of entries) * 4
of them, and they will only be generated on blank () squares.
- There must be at least 7 entires for the board generating process to work properly.
Here is a JSFiddle that will generate a random board for you to test with. Here's an example, with (number of entries) = 7
:
#####################
# o ##
# # o ##
# #o ###### ##
###### # ##
## o # # ##
## o# #o# o o##
## #o # # o # #
## # o # # # #
## ## # # o # #
## # # o # # #
## # o # ## # # #
## # # # #
# o # ## # #
# o oo ##o #
#o ####### oo ## #
# # # #
# o o o# #
# o #### o o#
# #
#####################
After the board is generated, each player is placed on a random square (empty space).
Input
You will take six lines of input. The first five lines are your field of vision (spaces out of bounds of the board will be represented by X
, and the middle space will always be *
, you), and the sixth line will be empty (at first).
Output
You will output three lines. First, the direction that you want to move in:
1 2 3
8 YOU 4
7 6 5
(9 is a no-op if you don't want to move), second, one of A
ttack, C
ounter, or N
othing (this will be explained in depth soon), and the thrid line will be any string of length up to 1024. This will be your bot's memory. You may use it for whatever you would like, or you may leave it blank. This memory will then be the sixth line of input to your program on the next run.
All further lines of output are ignored, and if there is only one line, the second is assumed to be blank.
Moving
The following process is used to determine where you moved:
- If, when you move, you end up in an empty space (
), your player is placed into that space.
- If you end up in a wall (
#
), your move is ignored and you lose your turn. - If you end up in an egg (
o
) or on a player (*
), this information is stored and will be used after everybody has moved.
After everybody has moved, ambiguities are resolved.
If there are two players that have landed on the same space, a fight occurs! This is where the A
/C
/N
comes in to play. A
ttack beats N
othing (normal attack), N
othing beats C
ounter (you can't counter nothing), and C
ounter beats A
ttack (counterattack). The player who wins this fight stays on their square, and the player who loses goes back to the original square that they started on. In the event of a tie, both players go back to where they were.
If a losing or tied player goes back to where they were and there is another player there, there is no fight and the other player will also revert to its original space. If this space has another player, that player goes back, and this continues until all players are in different spaces.
If there are three or more players on one space, they all revert back to their original positions.
If any player is still standing on an egg...
- If the player chose
A
, the egg is destroyed. - If the player chose
C
, nothing happens and the player reverts to its original space. - If the player chose
N
, the player picks up the egg! The player's score is incremented by one and the egg is removed.
Languages
You may use any language that is freely available on Windows, OSX, and Linux, to ensure fairness among each contestant. If the code is not freely runnable but can be compiled or packaged into a format that is, please include this format in your answer as well. Ideally, if you can compile your code into a more common language (i.e. CoffeeScript -> JavaScript), please do so.
Scoring
Your score will be the average number of eggs you collect out of ten runs. A run ends when all eggs are collected or when (number of entries * 25)
turns have passed. I will manually make sure that it is possible to reach all eggs for each map (by continually generating maps until all eggs are reachable).
Scoreboard
A scoreboard will be added when all of the following conditions are met:
- At least seven valid entries with a positive or zero score (not downvoted) have been submitted
- At least 48 hours has passed since the creation of this challenge (UTC 14:23)
The rules will not change during this pre-contest period, except to add clarification where a rule was unclear. Once the scoreboard is put up, the testing program will also be posted here so that you can test your entries. The testing code for this is still work-in-progress, but it's playable and it works. Here's the GitHub repo.
9
, he can never be meaningfully attacked. If another player (B) steps onto that players square and wins, A will be moved back to its original square (which is the same). But now there is a clash because both A and B are there, so B has to go back to his own square. So the result is independent of the actual fight, B always moves back to the initial square and A always stays put. That would allow me to write a both that could help another submission by blocking of a path for everyone else. \$\endgroup\$