Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge (snail game) | Loops
Introduction to TypeScript

Challenge (snail game)Challenge (snail game)

Task

Congratulations, you've been hired as a developer for the indie game 'Snail Simulator.' Your goal is to design the snail's movement logic. Snails are not very fast, and each snail has its own stamina. You need to calculate the maximum distance the snail will travel if it spends 2% of its stamina for every meter it covers. Use a while loop to solve this problem and then display the result on the screen. Good luck!

1. Your goal is to fill in the blanks (___) with the necessary variables.
2. The snail must have stamina above zero for movement.
3. For every meter the snail passes, it loses stamina_per_meter stamina.
4. When the snail has lost stamina, the distance covered should increase by 1 (increment).
5. Finally, output the distance the snail has traveled.

Все було зрозуміло?

Секція 4. Розділ 4
course content

Зміст курсу

Introduction to TypeScript

Challenge (snail game)Challenge (snail game)

Task

Congratulations, you've been hired as a developer for the indie game 'Snail Simulator.' Your goal is to design the snail's movement logic. Snails are not very fast, and each snail has its own stamina. You need to calculate the maximum distance the snail will travel if it spends 2% of its stamina for every meter it covers. Use a while loop to solve this problem and then display the result on the screen. Good luck!

1. Your goal is to fill in the blanks (___) with the necessary variables.
2. The snail must have stamina above zero for movement.
3. For every meter the snail passes, it loses stamina_per_meter stamina.
4. When the snail has lost stamina, the distance covered should increase by 1 (increment).
5. Finally, output the distance the snail has traveled.

Все було зрозуміло?

Секція 4. Розділ 4
some-alt