Git Product home page Git Product logo

amandaszoo's Introduction

Simple-Zoo-Simulator

Assignment for Programming and Problem Solving I done in 2021 with Journal, Pseudocode and Python code by Amanda W.

The Simple Zoo Simulator is a program that simulates a simple zoo for fun and profit.

You have a list of animals, which each generate "income" according to their name length (as everyone knows, longeranimal names mean higher profit at a zoo... but they cost more to buy). Each day when you wait, arandom "luck" value between 0-100 is generated, which determines how much income the animals generate, but if you are unlucky, a random animal will escape. You can buy new animals with theincome you make, but you cannot have more than one of each animal (name). The program starts with a welcome, some instructions and three animals. Then there's a repeating menu with the following four options:

• (W)ait

This simulates a day starting with luck between 0 and 100. If you get less than 33 (thinkabout constants) then a random animal from your list will escape and be deleted from the list. Animals are deleted before any income calculations. Each animal generates an amount of income according to the formula:luck / 100 * name lengthe.g., if luck is 70, a "Zebra" animal (5 characters) would generate 0.7 * 5 = 3.5 as aninteger, so an income of 3.

• (D)isplay animals

This simply displays the animals in your zoo (or “No animals.” if you have none).• (A)dd new animalo You can only add animals you can afford. You can have infinite animals but you cannothave any with the same name as existing animals. New animal names cannot be empty, so error-check and repeat for empty names.When you input an animal, the name should be converted to title case (using Python's.title() string method), so if the user enters "HEARTy bass", it will become "HeartyBass" (and would cost 11 income).When you add an animal, the name length (cost) is deducted from your total income.

• (Q)uit

This will end the main menu (follow the menu pattern!) and show the final details including the animals, the number of days simulated, the number of animals and theamount of income. Animals in the list should always be in alphabetical sorted order, but only sort when you need to(when the list has changed).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.