Virtual Life App with Health

 

 

Feature Specification

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



Code Design

 

 

 

 

 

 

 

 

    let itemOptions = {

 

        wall: { type: "wall", symbol: "w", buildChance: .1 },

 

        plant: { type: "plant", symbol: "p", buildChance: 0.02,

                    ableToMoveOn: [ "empty" ], ableToEat: [],

                    healthToReproduce: 57, healthToMove: 60 },

 

        animal: { type: "animal", symbol: "a", buildChance: 0.02,

                    ableToMoveOn: [ "empty" ], ableToEat: [ "plant" ],

                    plantChance: 0.07, healthToReproduce: 62, healthToMove: 62 },

 

        carnivore: { type: "carnivore", symbol: "c", buildChance: 0.02,

                    ableToMoveOn: [ "empty" ], ableToEat: [ "animal" ],

                    plantChance: 0.07, vegetarianChance: 0.48, healthToReproduce: 62, healthToMove: 62 },

 

        empty: { type: "empty", symbol: "z", buildChance: null }

    };