NaPoWriMo+GenMo2025_MatricesPoem

Poetic Carousel 5

For the 27th poem of NaPoWriMo/NaPoGenMo 2025, Poetic Carousel 5 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

Rules

Poetic Stanza 1 :
[['l' 'o' 'j']
 ['w' 'b' 'n']
 ['g' 'm' 'c']]
Poetic Stanza 2:
[['l' 'w' 'g']
 ['o' 'b' 'm']
 ['j' 'n' 'c']]

Output

Logic Outside Jurisdiction
Withering between nudges
Glowing more consistency

Indecisive, wandering glares
Offering below motions
Just nudging characters

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

#reading the file and adjusting it

f = open("E:/Genuary/NaPoWriMo2025/Poem 27 - Carousel/test.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