{"id":"recipe--console-pet","name":"Look after a tiny console pet","owner":"yeho","package":"recipes","kind":"recipe","signature":"start.yh","description":"Combine input, memory, decisions, and a loop into a whole program.","context":"Let's give the pieces a shared purpose. Pip wants three berries. Type feed to offer one, look to check progress, or quit to leave. This is a tiny game: it has an action, changing state, feedback, and an ending. Replace start.yh in your console project with the complete program below. There are no images or downloads inside the game. It uses the same text console we have already met.","parameters":[],"returns":"","members":[],"tags":["cpu","recipe"],"updated":"2026-09-09","source":{"repository":"demonhunterlabs","path":"app/lib/yeho-walkthrough.ts"},"status":"complete-program","notes":["Play once to the ending. Play again and quit early. Then change the goal to five berries everywhere it appears."],"examples":[{"id":"program","title":"Look after a tiny console pet","description":"Combine input, memory, decisions, and a loop into a whole program.","code":"int berries = 0\nConsole.Log(\"Pip wants 3 berries. Type feed, look, or quit.\")\nwhile berries < 3\n{\n    text action = Console.ReadLine()\n    if action == \"quit\" { end }\n    if action == \"feed\"\n    {\n        berries = berries + 1\n        Console.Log(\"Crunch!\")\n    }\n    else if action != \"look\"\n    {\n        Console.Log(\"Try feed, look, or quit.\")\n    }\n    Console.Log(Text.Format(\"Berries: {0} / 3\", berries))\n}\nif berries == 3 { Console.Log(\"Pip is ready for an adventure!\") }\nelse { Console.Log(\"See you soon, Pip.\") }","manifest":"manifestVersion = \"2\"\npackage = \"api.example.recipe__console_pet\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","tags":["cpu"],"run":"cpu-oracle","expected":null,"verification":"type checked","sha256":"05c47bf609c3e9da9b537614bf573124c657e88530f5c046057519bc9887e7ee","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=recipe--console-pet","json":"https://demonhunterlabs.com/reference/items/recipe--console-pet.json","markdown":"https://demonhunterlabs.com/reference/text/recipe--console-pet.md"}
