19
1
I was just playing the board game Sorry! with some people, and I realized that I could base a few interesting challenges off of it. This one is pretty simple.
You task is simply to output an ascii-art version of a sorry board, placing pieces where I tell you to.
Specs
First, here is an image of an actual Sorry! board for reference:
The empty board looks like:
# > - - o # # # # > - - - o # #
# # S v
o # H # # # # # |
| # |
| # S o
| # #
^ H #
# #
# #
# H v
# # |
o S # |
| # |
| # # # # # H # o
^ S # #
# # o - - - < # # # # o - - < #
Notice a few features.
- The
#
's are empty squares. - The
S
's andH
's are Start's and Home's respectively. - The
>v<^
's are the start of the slides, depending on which direction they face. - The
|
's and-
's are the middles of slides, depending on if they're horizontal or vertical. - The
o
's are the end's of slides. - Each column is separated by a column of spaces to make it look more square-like.
Now here is what you have to do:
- Your input is a list of coordinates of various pieces that have been placed on the board.
- The coordinates start at
0
at the square outside the Start of the bottom color (yellow in the picture), and increase by one per square clockwise. - After these 60 squares, the safe zones have the next and last 20 coordinates, starting from the one on the bottom (which gets 60-64), then going clockwise.
- You will have to place star's(
*
's) on the correct coordinate, replacing the character underneath for all players. - Additionally, if any of the players are on the start square of a slider, move them to the end of the slider before placing them.
- You can assume that there will be no collisions, before or after resolving sliders.
- You con't need to worry about the Home's or Start's.
- You can be 1-indexed if you want, but the test cases are 0-indexed.
Test Cases
[0, 20] ->
# > - - o # # # # > - - - o # #
# # S v
* # H # # # # # |
| # |
| # S o
| # #
^ H #
# #
# #
# H v
# # |
o S # |
| # |
| # # # # # H # o
^ S # #
# # o - - - < # # # # * - - < #
[2, 7, 66] ->
# > - - o # # # # > - - - o # #
# # S v
o # H # # # # # |
| # |
| # S o
| # #
^ H #
# #
# #
# H v
# # |
o S # |
| # |
| # * # # # H # o
^ S # #
# # o - * - < # # * # o - - < #
1I would have thought this would be more interesting if the values were given as distances from the respective start squares (so for instance the first test case might be
0, 5
and the second might be2, 60, 37
). – Neil – 2016-12-07T10:20:13.663@Neil how would you know which start square to use? – Maltysen – 2016-12-07T12:24:34.043
Sorry, I assumed that you used the squares in clockwise order, but I guess that wouldn't be very fair for a 2-player game. – Neil – 2016-12-07T12:26:21.877
@Closevoters: What's unclear about this? If you identify some specific concerns, it will make it easier to fix them so that this can stay open. – James – 2016-12-07T17:30:15.007
My confusion is about the indexing, before and after 60 has been reached and when to mark locations in the home section. I think if you clarified your examples more it would make more sense. Otherwise it looks pretty cool. – jacksonecac – 2016-12-07T20:34:47.380
Can you clarify safe zones. I see, that there are 4 such zones for each color with 5 cells. And how do we treat them? If bottom safe zone is yellow (which is unclear too), why 66 is the 4th cell from the right in green? (going clockwise) Where is the #60 cell in this zones? – Dead Possum – 2017-04-06T15:26:41.180