Tic-Tac-Toe-like table Generator
Description:
Do you have in mind the good old TicTacToe?
Assuming that you get all the data in one array, you put a space around each value, |
as a columns separator and multiple -
as rows separator, with something like ["O", "X", " ", " ", "X", " ", "X", "O", " "]
you should be returning this structure (inclusive of new lines):
O | X |
-----------
| X |
-----------
X | O |
Now, to spice up things a bit, we are going to expand our board well beyond a trivial 3
x 3
square and we will accept rectangles of big sizes, still all as a long linear array.
For example, for "O", "X", " ", " ", "X", " ", "X", "O", " ", "O"]
(same as above, just one extra "O"
) and knowing that the length of each row is 5
, you will be returning
O | X | | | X
-------------------
| X | O | | O
And worry not about missing elements, as the array/list/vector length is always going to be a multiple of the width.
Similar Kata:
Stats:
Created | Aug 25, 2018 |
Published | Aug 25, 2018 |
Warriors Trained | 5029 |
Total Skips | 124 |
Total Code Submissions | 8698 |
Total Times Completed | 2258 |
Ruby Completions | 62 |
Crystal Completions | 8 |
JavaScript Completions | 328 |
Python Completions | 1531 |
C++ Completions | 153 |
C Completions | 58 |
Java Completions | 130 |
C# Completions | 79 |
Total Stars | 76 |
% of votes with a positive feedback rating | 91% of 296 |
Total "Very Satisfied" Votes | 246 |
Total "Somewhat Satisfied" Votes | 46 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |