CodingAVideoGame_SeveralGames.Final

by nathalierun
See Code Download Embed
#SnapCon19 Young thinker night workshop

Coding a video game.

A player, named Alonzo, plays a video game that consists of 100 steps of 30 pixels on a game console whose resolution is 480 pixels by 360 pixels.
The game starts at the center of the screen. Before each step, Alonzo throws a tetrahedral dice whose balanced faces are numbered from 1 to 4.
If he rolls a 1, he moves 30 px to the right.
If he rolls a 2, he moves 30 px to the left.
If he rolls a 3, he moves 30 px up.
If he rolls a 4, he moves 30 px down.
The game ends:
- as soon as Alonzo has to leave the screen even if the 100 trips have not all been made.
- when 100 steps are done.
Alonzo must give 100 € to be able to play.
At the end of the game:
- if he comes back to O, he wins 1000000 €.
- if his position is 30 px from O or less (O excluded), he wins 500 €.
- if his position is between 30 px excluded and 60 px included from O, he wins 200 €.
- if his position is between 60 px excluded and 120 px included from O, he wins 10 €.
- he loses 200 € otherwise.
Alonzo asks himself the question: "Is the game fair?"

Created September 15, 2019

Last updated March 10, 2021

Published September 24, 2019