Giter Site home page Giter Site logo

di-workshop-08-adacat's Introduction

AdaCat

AdaCat is a tamagotchi style game representing the pet cat of an Ada student. Run the game and try playing for a while. Read through the code - look at the index.js, AdaCat.js, and CommandLineApp.js files - try to understand what they’re doing and how they work. Do the same with the unit tests in AdaCat.test.js.

Get set up

  1. Clone this repo and cd into it
  2. Install dependencies: npm install
  3. Check that everything's working by running the tests: npm test
  4. Start the app: node index.js
    • Try feeding and playing with the cat!
    • Tell the cat to nap and wake up again!
    • Press 0 to quit

Core tasks - most should be able to complete these

Complete the following tasks, using TDD throughout - writing unit tests first, then code, in a red/green/refactor cycle.

  1. Add comments across the code base explaining what everything does
  2. Add a new attribute to AdaCat called tiredness. Feeding the cat increases tiredness by 1. Playing with the cat increases tiredness by 3. Telling the cat to nap resets tiredness to 0. Tiredness can be between 0 and 15. Include tiredness in getDescription
  3. Add a new attribute to AdaCat called message that holds the cat’s status message. It starts off empty, but each time a method like feed or play gets called it gets updated. E.g. when play is called message is updated to “the cat is playing”. Include this message in getDescription
  4. Currently, the cat can be fed while it’s asleep. Modify the code so that this cannot happen and provide some feedback that you’re trying to feed a sleeping cat using the message attribute.
  5. Extend the AdaCat class to check that if the cat’s health goes below a certain value that a warning message appears in the description like “take your cat to the vet”

Challenges - try these if you finish the core tasks

  • Extend the cat with more behaviours and statistics to make the game more interesting
  • Copy the AdaCat class into a new P5 sketch. Can you provide a graphic interface to AdaCat without modifying the class?
  • Allow the user to have more than one cat at once

di-workshop-08-adacat's People

Contributors

somehats avatar tkatyarmal avatar

Watchers

James Cloos avatar

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.