In the NHL, players are often rated according to how many goals they score per game.In a regular season, the players play 82 games.If a player does not score in more than 7 games, they are often considered to be in a slump.If they score for 5 games in a row, they are considered to be on a streak.Given the scoring information below for three flames players, run a simulation of 10 seasons; each with 82 games. How many times will each player go on a streak or slump in each season?

Goals / Shots taken (scoring percentage)

Jarome Iginla
50/338 (14.8%)

Matthew Lombardi
14/181 (7.7.%)

Daymond Langkow
30/201 (14.9%)

The output should look somethings like this:
Season 1:

Jarome Iginla:

Shots taken: 300
Goals scored: 46
Shot percentage: 15.3%
Streaks: 3
Slumps: 2

Matthew Lombardi:

Shots taken: 166
Goals scored: 26
Shot percentage: 15.7%
Streaks: 2
Slumps: 3

7 Years
Discussion Span
Last Post by csurfer

You can take the player class as :

class player{
string name;
int goals_taken;      // Keeps count of goals taken
int shots_taken;      // Keeps count of shots taken
int num_streaks;    // Keeps count of streaks
int num_slumps;    // Keeps count of slumps

 // Keeps count of matches continuous where goals have been taken
int count_positives;
// Keeps count of matches continuous where no goals have been taken
int count_negatives;

//Here the positive counter goes on increasing if the player scores at least a single  
//goal in a match and is set back to 0 either if the counter reaches 5 where the streak 
// count is increased by one or when a loss appears in between.
//The negative counter increases when a player doesn't score a single goal in the 
//game and is set back to 0 either when the counter reaches 7 where the slump //count is increased by one or when there is a win in between.

//All the functions required to get the above concept to work.


You can use this class and can simulate the whole thing you have mentioned above.

Edited by csurfer: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.