NaPoWriMo x NaPoGenMo 2024 Day 27 : Rule Based Carousel

NaPoWriMo x NaPoGenMo 2024 Day 27 : Rule Based Carousel

Rule Base Poetry

Poetic Carousel

For the 27th day of NaPoWriMo/NaPoGenMo 2024, Poetic Carousel rules are coded in Ruby & Python: Where the starting letter of each word is derived from a 3x3 matrix that is generated with no repeat letters and then transposed.


First Poem

Poetic Stanza 1 :
[['x' 's' 'n']
 ['d' 't' 'a']
 ['g' 'e' 'z']]

Poetic Stanza 2:
[['x' 'd' 'g']
 ['s' 't' 'e']
 ['n' 'a' 'z']]
X-Men Singing Nervously
Dancing to Ambition
Gracefully, Energetic & Zesty  

Xylophone driven Grooves
Simply Tossing Energy
Naturely, Anti- Zoo

Second Poem

Poetic Stanza 1 :
[['m' 'd' 't']
 ['e' 'y' 'z']
 ['j' 's' 'p']]

Poetic Stanza 2:
[['m' 'e' 'j']
 ['d' 'y' 's']
 ['t' 'z' 'p']]
Magically Driven Tones
Eyeing Your Zones
Juicing Supreme Positions

Magically erasing jurisdictions
Decreasing your stubbornness
Teasing zonal publicness



Pre Poetic Rules in Ruby(SonicPi)

#random seed mapped to time, so it becomes "more" random

timer = use_random_seed

#range of letters in an array

grid = ('a'..'z').to_a

#shuffling as a random generator
grid_shuffled = grid.shuffle(random:

#empty erray
grid_final= []

#iteration to fill an array of 9 letters in
(0..8).each {|i| grid_final.push(grid_shuffled[i]) }

#print the final grid
puts grid_final.inspect

for letters in grid_final do
  puts letters

#Output to a file"E:/Genuary/NaPoWRiMO2024/Day 27 - 3x3 Poems/grid array.txt", "w+") do |f|


File Read

#reading the file and adjusting it

f = open("E:/Genuary/NaPoWRiMO2024/Day 27 - 3x3 Poems/grid array.txt", "r")
arr ="\n", " ") # replace newline with space


arr1 =  arr.split(" ")  #puts its as an array

#arr1 = arr1_space.pop() #takes away the space at the end

arr1_fix = arr1.pop() #removes last element


Rule Basis

def transformation(box):

    import numpy as np

    arr1 = np.array([[box[0],box[1],box[2]],[box[3],box[4],box[5]],[box[6],box[7],box[8]]])

    print(f'Poetic Stanza 1 :\n{arr1}')

    arr1_transpose = arr1.transpose()

    print(f'Poetic Stanza 2:\n{arr1_transpose}')