# Mathober2025_NumberFields

# **FieldofBase20**

For my 19th sketch of **Mathober2025** coded in **P5js(**remixed of a previous sketch**)**, **FieldofBase20** takes the 24th prompt of ***“Number Field”*** and makes a grid of ***base20*** numbers which are part of the field of rational numbers.

## Poetry

```ocaml
Numbers Field
Numbers Grid
Numbers wheel
Numbers Feel
Numbers Filled
```

## Images

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1760461744203/6d1c67b4-a2ee-4927-bb48-318e185b9b58.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1760461812189/ee17b736-fe10-4a5e-929c-881b60db8454.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1760461799082/35f7a8cf-53bc-46b1-a9e0-1087edd9ead2.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1760461803791/d067970c-5a12-48e9-9594-bb2dff78a882.png align="center")

## Code

### P5js

```javascript
function setup() {
  createCanvas(windowWidth, windowHeight);

  //PROMPT
  x1 = prompt("choose a number between 0 and 159999");
  x2 = prompt("choose another number between 0 and 159999");
  x3 = prompt("choose a number larger than 159999 or smaller than 0");
  x4 = prompt("choose another number between 8000 and 159999");
  x5 = prompt("choose any number");
}

//Font
let usedFont = ["fantasy", "monospace", "georgia", "Courier New"];

//ARRAYS For Colors
let fillnumber = ["orange", "yellow", "gold", "red", "pink", "salmon", "coral"];
let fillnumber2 = [
  "blue",
  "teal",
  "skyblue",
  "navy",
  "turquoise",
  "royalblue",
  "midnightblue",
];

function draw() {
  

  
  // numbers in based 20 translation
  let numbers = [
    based_multi(x1, 20),
    based_multi(x2, 20),
    based_multi(x3, 20),
    based_multi(x4, 20),
    based_multi(x5, 20),
  ];

  background("black");
  textSize(35);

  //Varied Framerate
  frameRate(Math.cbrt((second() % 35) + 3));

  //Nested for loops to get grid like factor
  for (let i = 0; i < windowWidth; i = i + 125) {
    for (let j = 0; j < windowHeight; j = j + 150) {
      if (i % 15 > 7) {
        textFont(random(usedFont));
        stroke(random(fillnumber));
        strokeWeight((second() % 30) + 5);
        fill(random(fillnumber2));
        text(random(numbers), i + random(35, 44), j + 10);
      } else {
        textFont(random(usedFont));
        stroke(random(fillnumber2));
        strokeWeight(random(second() % 30) + 5);
        fill(random(fillnumber));
        text(random(numbers), i + 10, j + random(27, 3) + (second() % 3));
      }
    }
  }
}
// allow for fullscreen without switching
function mousePressed() {
  if (
    mouseX > 0 &&
    mouseX < windowWidth &&
    mouseY > 0 &&
    mouseY < windowHeight
  ) {
    let fs = fullscreen();
    fullscreen(!fs);
  }
}

//allows for translation into any base system
//takes an int I and translates it to a
function based_multi(i, b) {
  return Math.abs(i).toString(b);
}
```
