recipes · recipe ·
Look after a tiny console pet
Combine input, memory, decisions, and a loop into a whole program.
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.
start.yhStatus: complete-program
Look after a tiny console pet
Combine input, memory, decisions, and a loop into a whole program.
cpu · type checked
int berries = 0
Console.Log("Pip wants 3 berries. Type feed, look, or quit.")
while berries < 3
{
text action = Console.ReadLine()
if action == "quit" { end }
if action == "feed"
{
berries = berries + 1
Console.Log("Crunch!")
}
else if action != "look"
{
Console.Log("Try feed, look, or quit.")
}
Console.Log(Text.Format("Berries: {0} / 3", berries))
}
if berries == 3 { Console.Log("Pip is ready for an adventure!") }
else { Console.Log("See you soon, Pip.") }project.mech
manifestVersion = "2"
package = "api.example.recipe__console_pet"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"
[app]
kind = "headless"
Notes and source
Play once to the ending. Play again and quit early. Then change the goal to five berries everywhere it appears.
demonhunterlabs/app/lib/yeho-walkthrough.ts