General Assembly Logo

Tamagotchi Challenge

Prerequisites

  • Understanding of how to define and access properties
  • Understanding of how to define and invoke functions, including constructor functions

Instructions

  1. Fork and clone this repository.
  2. Fulfill the listed requirements.

Requirements

Build a Tamagotchi

What is a tamagotchi? According to wikipedia, the name is a portmanteau combining the Japanese word tamago (たまご), which means "egg", and the English word "watch". Most Tamagotchi characters' names end in tchi (っち) in Japanese, with few exceptions.

A tamagotchi has a few properties:

/*
- name
- weight
- age
- birthday
- description
- hungerLevel
- happinessLevel
- attentionLevel
- lifeStage // Baby, Child, Teen, and Adult
/*

A few states:

/*
- isHungry
- wantsToPlay
- isHappy
- needsAttention
*/

And a few behaviors:

eat() {
/* feeding should satisfy hunger, depending on what you feed it, and may increase weight
 grass, meat, tofu, bread, candy, etc…
*/
}

speak() {
 /* what needs does your tamagotchi have? */
}

play() {
 /* playing with your tamagotchi should increase happiness, satisfy need for attention, and may decrease weight */
}

Usage:

tamagotchi.age // 0
tamagotchi.birthday // today's date
tamagotchi.weight // 1 
tamagotchi.description // 'A <lifeStage> tamagotchi named <name> born on <birthday> weighing <weight>'
tamagotchi.speak() // 'Mesutchi is <some state>'

Bonus:

Continue to implement a real tamagotchi, adding the following properties and methods:

Properties:

/*
- disciplineLevel
- isDisciplined
- needsBathroom
- itPottyTrained
- isSick
- sleeping
*/

Methods:

sleep()

wake()

scold() {
 /* fills discipline level, reduces happiness level */
}

useBathroom()

view() {
 /* displays image of the tamagotchi */
}

What else can your tamagotchi do?

License

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.