20
3
For this challenge you will print the coordinates and color of each piece at the start of a game of checkers.
Enter the x and y (comma seperated) for every square (indexed 0-7) on a checkerboard, followed by a "r" or "b" (for red or black) where the top of the board (closer to y=0) is red and the bottom is black. newlines between pieces are required and no spaces are necessary.
This is code-golf so answers are scored in bytes with fewer bytes being better.
Trailing newlines are allowed but not necessary and the order must be exactly of that below.
Desired output:
0,0r
0,2r
0,4r
0,6r
1,1r
1,3r
1,5r
1,7r
2,0r
2,2r
2,4r
2,6r
5,1b
5,3b
5,5b
5,7b
6,0b
6,2b
6,4b
6,6b
7,1b
7,3b
7,5b
7,7b
Ok is the above edit sufficient? Sorry this is my first post to this stack exchange. If it's not sufficient could you edit it? Thank you – Justin – 2017-09-27T22:23:14.737
Is a trailing newline allowed/necessary? – HyperNeutrino – 2017-09-27T22:27:02.377
Allowed: yes. Necessary: no – Justin – 2017-09-27T22:27:51.460
3Is there a particular reason you skip
x=3
andx=4
? – HyperNeutrino – 2017-09-27T22:35:03.6771@HyperNeutrino because a checkerboard has only the top and bottom 3 rows filled (at the start of the game) – Justin – 2017-09-27T22:36:03.127
Oh you're talking about pieces ._. nvm my answer isn't adjustable rip – HyperNeutrino – 2017-09-27T22:36:46.280
3
So that's basically the starting position of Checkers, aka English Draughts. Is that correct?
– Arnauld – 2017-09-27T22:47:03.710Does the order of the output matter? – Digital Trauma – 2017-09-27T23:02:46.583
2
Welcome to PPCG.SE! A feature of this site that some of us like to use is the sandbox. You don't have to use it, but it is a useful channel through which to get feedback about any new challenge ideas you have, without having to go through the whole downvote/closevote misery.
– Digital Trauma – 2017-09-27T23:06:17.670@DigitalTrauma Yes order must be as displayed in the question – Justin – 2017-09-28T01:51:58.050
1Can the coordinates be separated by a delimiter other than a new-line? I.e.
0,0r;0,2r;0,4r;0,6r;1,1r;1,3r;1,5r;1,7r;2,0r;2,2r;2,4r;2,6r;5,1b;5,3b;5,5b;5,7b;6,0b;6,2b;6,4b;6,6b;7,1b;7,3b;7,5b;7,7b
? – Kevin Cruijssen – 2017-09-28T11:52:29.667Can the delimiter for the coordinates themselves be different, like a space. I.e
0 0r\n0 2r\n
...? – Stan Strum – 2017-09-28T17:19:22.257