Position: Gusto new grad SWE
1 Technical Question:
Implement a function that takes a Connect Four board string and decodes it into a
representative 2D array.
For an input string of "9_r4_brbrbr_3b2rb_b2r2br_r2b3rb"
The output board would look like:
____
_||r|__|
|b|r|b|r|b|r||
|b|b|b|r|r|b|
|b|r|r|b|b|r_|
|r|b|b|r|r|r|b|
This function should return an array of character arrays.
The strings should be one of:
r to indicate a red piece
b to indicate a black piece
_ to indicate an empty space
The input string is not necessarily a valid board string. It is guaranteed not-empty.
The board size is 6x7. There should be only 42 characters.
The difference between the number of red and black pieces should be no more than 1.
Test Cases:
Works drawBoard("rrrrrrrbbbbbbbrrrrrrrbbbbbbbrrrrrrrbbbbbbb");
Works drawBoard("7_7_7r7b7r7b");