Skittles are colored candy where there are 5 distinct flavors; grape, green apple, lemon, orange, and strawberry represented by (p)urple, (g)reen, (y)ellow, (o)range, and (r)ed respectively. I used to eat skittles by sorting all the different colors, then eating them in sequence. After getting a few weird looks in the office, I now pretend to eat them like a normal person. Your task is to emulate this:
Your code (full program or function) will receive an array of skittles (10x10) as input (in any reasonable format). This array will represent a pile of unsorted skittles. Your task is to "eat" them from your least favorite to favorite color. My preferred order is grape, green apple, lemon, orange, strawberry, but you are free to choose any order so long as it is consistently enforced (please list your preference in your submission so I can judge you for it). After eating each piece of candy your code will output (in the same format you take input) the remaining pile with the eaten piece replaced by a space. You will repeat until only your favorite remains. You may choose any skittle to eat (may be random or deterministic). Trailing spaces must be kept.
For example, your output sequence could look like this (using 5x5 for brevity and showing spaces as
start 1 2 3 4 5 n .org. .org. .org. .org. .or.. .or.. ..r.. prgrg .rgrg .rgrg .rgrg .rgrg .r.rg .r.r. gggpr gggpr ggg.r ggg.r ggg.r ggg.r ....r oyyor oyyor oyyor oyyor oyyor oyyor ....r .r.p. .r.p. .r.p. .r... .r... .r... .r...
This is code-golf, so shortest code in bytes wins
- Submission may be full program or function
- Input may be taken in any reasonable format (string, list, matrix, etc) by any reasonable method (STDIN, function arguments, etc.). However there must be some delineation between rows
- Output must be produced in the same format as input by any reasonable method (STDOUT, function return, ect.). Intermediate output may or may not be delimited
- First output shall be the first input
- Trailing spaces must be preserved
- Any color order may be used (list in your answer)
- Any skittle of the current color may be eaten
- Last output shall be only your favorite color and spaces
- If possible, include a link to an online compiler to test your submission