NaPoWriMo x NaPoGenMo 2024 Day 27 : Rule Based Carousel

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.

Poems

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

Images

Code

Pre Poetic Rules in Ruby(SonicPi)

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

timer = use_random_seed Time.now.to_i

#range of letters in an array

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

#shuffling as a random generator
grid_shuffled = grid.shuffle(random: Random.new(timer))

#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
end

#Output to a file

File.open("E:/Genuary/NaPoWRiMO2024/Day 27 - 3x3 Poems/grid array.txt", "w+") do |f|
  f.puts(grid_final)
end

Python

File Read

#reading the file and adjusting it

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

print(arr)

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

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

print(arr1)
arr1_fix = arr1.pop() #removes last element

print(arr1)

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}')

transformation(arr1)
0
Subscribe to my newsletter

Read articles from Kofi / Illestpreacha directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kofi / Illestpreacha
Kofi / Illestpreacha