Add symbol aquarium support

This commit is contained in:
hgw 2023-10-03 23:38:37 +00:00
parent a65871849d
commit cf67aa740e
Signed by: hgw
SSH Key Fingerprint: SHA256:diG7RVYHjd3aDYkZWHYcBJbImu+6zfptuUP+3k/wol4
4 changed files with 62 additions and 3 deletions

View File

@ -25,6 +25,9 @@ var phish = require('phishies')
//phish.aquarium(height, width)
phish.aquarium(5, 5) //generates a 5x5 aquarium
//phish.aquarium_sym(height, width)
phish.aquarium_sym(5, 5) //Same as above but uses symbols instead of emojis for better compatibility
```
`phish.aquarium(h,w)` putputs an array of the following form:

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "phishies",
"version": "1.1.0",
"version": "1.2.0",
"lockfileVersion": 1
}

View File

@ -1,6 +1,6 @@
{
"name": "phishies",
"version": "1.1.0",
"version": "1.2.0",
"description": "Node.js aquarium generator module",
"main": "phish.js",
"repository": {

View File

@ -9,6 +9,7 @@
// Aquarium generator - ANOTHER SUPERNETS BANGER
// Inspired by https://botsin.space/@EmojiAquarium
// Emoji fish
var fish_types = ["🐟", "🐡", "🐠"]
var rare_swimmer_types = ["🐙", "🐬", "🦑", "🦈"]
var plant_types = ["🌱", "🌾", "🌿"]
@ -17,6 +18,14 @@ var exceedingly_rare_junk = ["🎱", "🎲", "🎮", "🗿", "🎷", "💎", "
var super_exceedingly_rare_junk = ["🗽", "🔱", "🛳️"]
var bubbles = ["°゚", "º", "。"]
// Non-emoji fish
var n_fish_types = ["𓆝", "𓆟", "𓆞", "𓆜"]
var n_rare_swimmer_types = ["𓇼", "𓆡", "𓆉︎", "𓆛"]
var n_plant_types = ["𓆸", "𓋼", "𖥧", "𓇗", "𓇣"]
var n_rare_bottom_dwellers = ["𓆑", "𓆨"]
var n_exceedingly_rare_junk = []
var n_super_exceedingly_rare_junk = ["𓀐𓂸", "𓃶", "𓃱", "✈"]
function aquarium(height, width) {
aquariumArray = []
if (height == undefined) {
@ -61,4 +70,51 @@ function aquarium(height, width) {
return aquariumArray
}
module.exports = { aquarium }
function aquarium_sym(height, width) {
aquariumArray = []
if (height == undefined) {
height == 5
}
if (width == undefined) {
width = 6
}
for(let i = 0; i < height; i++) {
lineArr = []
var heightLine = i
if (i != height-1) {
for(let i = 0; i < width; i++) {
if ([0,1].includes(heightLine) && Math.random()*100<7) {
lineArr.push(bubbles[Math.floor(Math.random()*bubbles.length)])
} else if (Math.random()*100<10) {
lineArr.push(n_fish_types[Math.floor(Math.random()*n_fish_types.length)])
} else if (Math.random()*100<2) {
lineArr.push(n_rare_swimmer_types[Math.floor(Math.random()*n_rare_swimmer_types.length)])
} else {
lineArr.push(' ')
}
}
}
if (i == height-1) {
for(let i = 0; i < width; i++) {
if (Math.random()*100<30) {
lineArr.push(n_plant_types[Math.floor(Math.random()*n_plant_types.length)])
} else if (Math.random()*100<2) {
lineArr.push(n_rare_bottom_dwellers[Math.floor(Math.random()*n_rare_bottom_dwellers.length)])
} else if (Math.random()*100<0.5) {
lineArr.push(n_exceedingly_rare_junk[Math.floor(Math.random()*n_exceedingly_rare_junk.length)])
} else if (Math.random()*100<0.25) {
lineArr.push(n_super_exceedingly_rare_junk[Math.floor(Math.random()*n_super_exceedingly_rare_junk.length)])
} else {
lineArr.push(' ')
}
}
}
aquariumArray.push(lineArr.join(''))
}
return aquariumArray
}
module.exports = {
aquarium,
aquarium_sym
}