From cf67aa740e6e95fc6572e614f15d6ce47ba8e9ad Mon Sep 17 00:00:00 2001 From: hgw Date: Tue, 3 Oct 2023 23:38:37 +0000 Subject: [PATCH] Add symbol aquarium support --- README.md | 3 +++ package-lock.json | 2 +- package.json | 2 +- phish.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7141a57..d1f8268 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/package-lock.json b/package-lock.json index 2b1d394..219565c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { "name": "phishies", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1 } diff --git a/package.json b/package.json index b9b7de4..7fbccff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phishies", - "version": "1.1.0", + "version": "1.2.0", "description": "Node.js aquarium generator module", "main": "phish.js", "repository": { diff --git a/phish.js b/phish.js index 216e6e2..14c70ff 100644 --- a/phish.js +++ b/phish.js @@ -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 } \ No newline at end of file +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 +} \ No newline at end of file