NaPoWriMo x NaPoGenMo 2024 Day 18: Numbers to Poetry

For the 18th day of NaPoGenMo/NaPoWriMo 2024, "Numerical Intentions" is coded in p5js and uses numbers in various bases to alter the poem.

Interactive Poem

https://illestpreacha.itch.io/numerical-intentions

Partial Translations

13635 base-10 = AIR base-36
GRASS base-36 = 28147564 base-10
616226449270 base-10 = BOUNCING base-34
Prouncing base-34 = 46101447673974 base-10
14048065 base-10 = AHEAD base-34
519188139 base-10 = BEHIND base-34

Code

let numberChoice;

function setup() {
  //DropDown Menu

  textAlign(CENTER);
  createCanvas(800, 800);

  group1 = selectiongroup(
    "numberChoice",
    "2249480433004",
    "2249486824876",
    "61820903788",
    "1717244908",
    "2240780255404",
    3.25,
    5.5
  );

  group2 = selectiongroup(
    "numberChoice2",
    "27681716485",
    "27681500863",
    "27681321178",
    "27681069619",
    "27681608674",
    2,
    5.5
  );

  group3 = selectiongroup(
    "numberChoice3",
    "2249480433004",
    "2249486824876",
    "61820903788",
    "1717244908",
    "2240780255404",
    3.25,
    4.5
  );

  group4 = selectiongroup(
    "numberChoice4",
    "27681716485",
    "27681500863",
    "27681321178",
    "27681069619",
    "27681608674",
    2,
    4.5
  );

  group5 = selectiongroup(
    "numberChoice5",
    "36802",
    "1778108369279",
    "13635",
    "28147564",
    "724154",
    1.5,
    4.5
  );

  group6 = selectiongroup(
    "numberChoice6",
    "14048065",
    "519188139",
    "1150460937",
    "616226449270",
    "46101447673974",
    1.5,
    5.5
  );
}

function draw() {
  background(220);
  textAlign(CENTER);
  textSize(width / 20);
  text("What Numbers Fits your Mood", width / 2, height / 7);

  //take the value that was pressed in option and turn it into int
  let conversion = parseInt(group1.value());
  let conversion2 = parseInt(group2.value());
  let conversion3 = parseInt(group3.value());
  let conversion4 = parseInt(group4.value());
  let conversion5 = parseInt(group5.value());
  let conversion6 = parseInt(group6.value());

  textSize(width / 30);

  if (second() % 4 > 2) {
    text(
      "The Sea is " + based_multi(conversion, 36).toUpperCase(),
      width / 2,
      height / 3.25
    );
    text(
      "The Leaves are " + based_multi(conversion2, 33).toUpperCase(),
      width / 2,
      height / 2.5
    );
  } else {
    text(
      "The " +
        based_multi(conversion5, 36) +
        " is " +
        based_multi(conversion2, 33).toUpperCase(),
      width / 2,
      height / 3.25
    );
    text(
      "The Leaves are " + based_multi(conversion, 36).toUpperCase(),
      width / 2,
      height / 2.5
    );
  }

  if (second() % 6 > 3) {
    text(
      "Time is either Behind or " +
        based_multi(conversion3, 36).toUpperCase() +
        " and " +
        based_multi(conversion4, 33).toUpperCase(),
      width / 2,
      height / 2
    );
  } else {
    text(
      "Time is either " +
        based_multi(conversion6, 34) +
        " or " +
        based_multi(conversion4, 33).toUpperCase() +
        " and " +
        based_multi(conversion3, 36).toUpperCase(),
      width / 2,
      height / 2
    );
  }
}

function selectiongroup(x, a, b, c, d, e, xpos, ypos) {
  x = createSelect();
  x.option(a);
  x.option(b);
  x.option(c);
  x.option(d);
  x.option(e);
  x.position(width / xpos, height / ypos);
  return x; //for the value to show up
}

//converts the number shown into a different based
function based_multi(i, b) {
  return Math.abs(i).toString(b);
}
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