--- tags: mstu5003, doodle --- # Data of My Life ### Group Members: Ivy Wu, Beikun Ma, Bill Wang Because Halloween is coming πŸŽƒ, we have decided to talk about one day of a vampire Nikolas. πŸ§›β€ ```:javascript= let name = "Nikolas"; let power = 50; let isVulnerable = true; let hungerLevel = 100; // Nikolas is vampire, but he acts like a normal student at TC by day and go hunting for human's blood by night. // Nikolas is vulnerable from sunshine when the sun is up or exposed to any strong light directly. getTime(); // <<< 6pm, when sun sets // When the sun sets, he reveals his vampire's true nature (fangs, pointy ears, pale skin). name = "Vampire Nikolas"; power += 1000; // 1050 isVulnerable = false; // He visits TC dorms for hunting three times in an evening. The TC dorms has 3 floors, so he visits floor by floor. let tcDorms = { isProtected: false, protectLevel: 0, protectType: "securityStaff", floors: ["firstFloor","secondFloor","thirdFloor"] } // Vampire Nikolas hunts for human's blood from the dorm until he is not hungry anymore or become vulnerable. let numVictim = 0; function findVictim(dorms) { // if the dorms is not protected. // then vampire Nikolas will hunt the victim, take them home and drink their blood. // when Nikola is still hungry, he will visit the dorm and continue the hunt. numVictim++; } function huntVictim() { if power > tcDorms.protectLevel then tcDorms.isProtected = 0; tcDorms.protectLevel = 0; protectType = "securityStaff"; hungerLevel -= 30; else power -= 1000; } huntVictim(tcDorms); // First visit, victim found. huntVictim(tcDorms); // Second visit, victim found. // All seems well with the hunting. But suddenly… isProtected: ture, protectLevel: 1200, protectType: "superJin", // All floors from tcDorms.floors set to "stronglyLighted" under the protection of Super Jin. findVictim(tcDorms); // The tcDorms is being protected! isVulnerable = true; // Vampire Nikolas is now vulnerable! hungerLevel = 40; // Vampire Nikolas is still hungry! // Vampire Nikolas is weaker than the protect level! 1200 to 1050 // Because of the strong light, Vampire Nikolas is defeated by supeJin. // The tcDorms return to normal (see huntVictim algorithm) and Vampire Nikolas lose lots of power, now he cannot continue the hunt. // However, Vampire Nikolas gets away from superJin and returns to home. goHome(); // Vampire Nikolas goes to home to prepare for another hunting day... ```