this post was submitted on 05 Jul 2024
3 points (80.0% liked)

Web Development

3380 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Hey everyone!

I wanted to share a little side project I’ve been working on: a Planet Zoo Animal Picker. It’s a simple tool designed to help you choose a random animal for your Planet Zoo game.

I know there are already tools out there, and mine isn't necessarily better, but it's something I created and I’m proud of it. It's just a fun little project I wanted to share with the community.

It's written in Vue/Quasar, src

Feel free to check it out, and for anyone that plays the game: Happy zookeeping! 🦁🐘

top 2 comments
sorted by: hot top controversial new old
[–] chiisana@lemmy.chiisana.net 1 points 1 month ago (1 children)

Uncheck all the DLCs except for wetland, you should have maybe 8 animals left. Play with the habitat options abit if you don’t, but eventually settle on Exhibit, you should end up with just Danube Crested Newt. Now go and turn off each individual biome slowly. One would expect the Newt to disappear and never come back, but instead it pops in and out of existence. Something quirky is happening and you may wish to review the logics.

[–] Hansie211@lemmy.world 1 points 1 month ago

You are correct. Its quiet a find but I can reproduce this. I suspect the issue lies in the piece of code that tries to make sure you don't get the same animal twice when you select a random animal. You can also follow the steps until there is only the Newt and then press the dice below it's name. Now there are no animals.

The random selector subtracts one from the total options and adds that one back if the new number is greater or equal to the precious number. So in case of only a single option it gets 0 at random, which equals the previous index and does +1, which doesn't exist.

There should be a failsafe that prevents this logic if there is only one animal in total πŸ€·β€β™‚