6 kyu

Tic-Tac-Toe-like table Generator

1,531 of 2,258GiacomoSorbi

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.

ASCII Art
Fundamentals

Stats:

CreatedAug 25, 2018
PublishedAug 25, 2018
Warriors Trained5029
Total Skips124
Total Code Submissions8698
Total Times Completed2258
Ruby Completions62
Crystal Completions8
JavaScript Completions328
Python Completions1531
C++ Completions153
C Completions58
Java Completions130
C# Completions79
Total Stars76
% of votes with a positive feedback rating91% of 296
Total "Very Satisfied" Votes246
Total "Somewhat Satisfied" Votes46
Total "Not Satisfied" Votes4
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • GiacomoSorbi Avatar
  • ParanoidUser Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • KataSideKick Avatar
  • clcraig Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • user8436785 Avatar
  • Just4FunCoder Avatar
  • PetitLu117 Avatar
Ad