Sokobunny 1
You love buns! You love them so much, that you chased one down a bunburrow. The burrows are like mazes, and YOU WANT TO CATCH THE FLUFFBALLS!!!! However, the buns are smart! You can't catch the bun by by chasing after it, as you wait out of politeness for the buns.
Taken from the game Paquerette Down the Bunburrows
(This is imo easily the best puzzle game out there, as it is meta meta meta meta ... echoes until inaudible)
Bun behavior
- Buns will run straight away from you if they can, until they reach a tile with a non-wall left or right. It they see no exits, they run straight ahead.
- A bun is comfortable until you are closer than two squares (manhattan), this means a bun will keep a distance of two empty squares horizontally and vertically, but won't care about diagonals.
- A bun won't choose to go into a dead end it can see.
- A bun can see horizontally and vertically and and tell if it is a straight dead end.
- A bun can see all adjacent squares (horiz, vert, and diag)
- A bun will prefer to turn left, if given the choice.
- A bun is captured if on the same tile as a player.
Challenge:
Shortest wins!
- Global guarantees: No buns will ever be harmed in the making of these challenges.
- Guarantees (this challenge only):
- no bun will be captured
- no bun will run out of bounds
- mazes will always be a rectangle
- Inputs:
- Ascii Maze:
#
is a wall, and - Player position. (Col, row), starting from top-left at (0, 0)
- Bunny position. Same scheme
- Ascii Maze:
- Outputs:
- New bunny position
- All rotated inputs should output the same relative position
- You must treat any non
#
character as a wall. This applies expressly to theP
andB
characters.
the bun after it moves (if it does).
Visual representation (Not valid for challenge):
B is bun, b is where bun goes.
███████████████████████████████████████
████████████████████████ ███ ██████
█████████████████████ ███
██████████████████████████████ ██████
██████ P B------->b ███
████████████ ████████████████████████
███████████████████████████████████████
Maze:
#############
######## # ##
####### #
########## ##
## P B #
#### ########
#############
Player: (5, 4)
Bun: (7, 4)
Output: (10, 4)
Maze:
#############
######## # ##
####### #
########## ##
## P B #
#### ########
#############
Player: (8, 4)
Bun: (10, 4)
Output: (10, 2)
Maze:
############################
#P B #
######################### ##
############################
Player: (1, 1)
Bun: (3, 1)
Output: (25,1)
Maze:
######
### ##
#P B##
### #
######
Player: (1, 2)
Bun: (3, 2)
Output: (3, 3)
Maze:
#######
### ##
## B###
## ###
###P###
#######
Player: (3, 4)
Bun: (3, 2)
Output: (2, 2)
Maze:
#######
#P B #
#######
Player: (1, 1)
Bun: (4, 1)
Output: (4, 1)
Maze:
#######
# P B #
#######
Player: (2, 1)
Bun: (4, 1)
Output: (5, 1)
Maze:
#######
# PB #
#######
Player: (3, 1)
Bun: (4, 1)
Output: (5, 1)
```