From the course: PHP for Non-Programmers

Requirements: What the game should do - PHP Tutorial

From the course: PHP for Non-Programmers

Requirements: What the game should do

- [Presenter] Our first project is a simple game that will flip a coin and then display heads or tails. And with any project, we need to lay out what we need to do. This is called the project requirements. We will simulate flipping a coin by randomly generating either a one for heads or zero for tails. Then, we'll display the results to the user and prompt the user to see if they want to flip again. They will answer with either Y for yes or N for no. A couple of notes, we've discussed functions as features but not how to find those features yet. So, we'll make use of a function called random int, where you provided a range of integers to select from and it will randomly generate from that list. Note that zero and one can also be used as Boolean values. And, for simplicity sake, we'll assume the user will only ever input a lower case Y or a lower case N. You can try your hand at a solution if you'd like. We'll run through two solutions, one executing the code once, and one asking for user input to keep going.

Contents