1
\$\begingroup\$

Suppose you have a grid of cells that is 6 wide and arbitrarily tall. In each cell is a word. Let the bottom row, which is row #1, be the last 6 words of sample.txt in order. Let the second to last row, which is row #2, be the 6 words before those in order. (etc.)

Then consider what happens when you remove some of the words according to the pattern pictured below. When the word in a pink-colored cell is removed, all of the words from previous cells are shifted forward. The new index of the word in cell C_i,j becomes C_i,j-1 unless it's originally in the last column where j=1, in which case the new index of the word in the cell C_i,j becomes C_i-1,j .

What words are in each of the 36 cells after removing all of the words in the pink cells 3333 times? Write a program that prints them in order, from top to bottom, left to right.

diagram with 6 by 6 grid of cells

Download sample.txt

This file is the tiny_shakespeare dataset with all of the punctuation and line breaks removed.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Welcome to PPCG! It looks like some people voted to close your challenge but forgot to post a comment to help you improve it so it can be reopened. Like the (super terse) message above says, your challenge needs an objective winning criterion. Most challenges here are code-golf but there are others like fastest-code. A good resource for writing challenges that don’t get closed is this help page. \$\endgroup\$
    – Jordan
    Jun 20 at 13:25
  • \$\begingroup\$ "...unless it's originally in the last column where j=1, in which case the new index of the word in the cell C_i,j becomes C_i-1,j ." is the intention to wrap down to the next row? If so I think "C_i-1,j" should be "C_i-1,6". If not, then what happens regarding any resulting collisions? \$\endgroup\$ Jun 20 at 16:37
  • 1
    \$\begingroup\$ In addition to making this (most likely) code-golf I'd also recommend (1) allowing the original word list to be an input (rather than making people add boiler-plate file IO) to keep to the core of the challenge, (2) providing a test case (I think one is fine as there are no edge-cases to cover), and, perhaps, (3) having the number of repetitions be an input rather than being fixed at 3333. \$\endgroup\$ Jun 20 at 16:46

0

Browse other questions tagged or ask your own question.