Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP PHP Arrays and Control Structures PHP Loops Ping Pong

Waqar Mohammad
Waqar Mohammad
2,914 Points

The rules of the game state to win a round you need 11 as a minimum score, but the output is not requiring that.

The rules of the game state to win a round you need 11 as a minimum score, but the output is not requiring that?

Hi Waqar,

Can you give the time in the video where the output is not requiring that?

3 Answers

I'm not sure but are you confusing the points with the round number?

It looks like the script was tested twice.

At 6:20 in the video you can see the results of the first run. It shows that player2 has 11 points and it's at least 2 points higher than player1 so it ends.

At 7:29 is the second results. It ends with player2 having 11 points.

Waqar Mohammad
Waqar Mohammad
2,914 Points

Hi Jason,

From what I understand, a player has to reach 11 points && be clear by 2 points to win the round - so 13/11 or 11/9 etc. If you look at the video @ 6.13 it shows a few rounds in which the condition of 11 points hasn't been met. Or am I mistaken?

Those rules are for winning the game.

Each round one of the players will get a point.

Then at the end of each round the players points are checked against the rules to see if there is a winner or if it needs to go another round.

You can think of it as a game is made up of multiple rounds.

Here's the rules from the Teacher's Notes:

To Win

    player must reach a score of 11
    player must be a minimum of 2 points higher than opponent

WHILE those conditions are NOT met, a single player will receive 1 point at the end of each round.
Waqar Mohammad
Waqar Mohammad
2,914 Points

@Jason, Thanks for getting back. Its throughout the video. The out put code doesn't require the games to go up to 11 points?

Waqar