Git Product home page Git Product logo

scorecard's Introduction

scorecard

Scorecard

Score your Cricket Matches as you play them and track the statistics!

Scorecard is a mobile application that helps you record matches on a ball-by-ball basis for easier score-keeping and tracking of statistics, all while enjoying the sport with your friends and family.


๐Ÿ—‚๏ธ Contents


๐Ÿ”ง Building the App

As this application is programmed in Flutter, you can perform the common steps to build and run a flutter application.

  1. If you don't have Flutter SDK installed, please visit official Flutter site.

  2. Fetch latest source code from master branch.

git clone https://github.com/PlayPratz/Scorecard.git
  1. Run the app with Android Studio or VS Code. Or the command line:
flutter pub get
flutter run

โš™๏ธ Core Concepts

A Cricket Match is represented by the following constructs or concepts:

  1. Cricket Match
  2. Innings
  3. Ball
  4. Player
  5. Statistics

๐Ÿ Cricket Match

It's a match played between two teams. What more can I say? Maybe a lot more; will expand on this later on.

๐Ÿ Innings

An innings is one division of a cricket match where one team bats while the other team bowls and fields. Throughout this app, an "innings" refers only to a team's innings; batter innings and bowler innings are mentioned as such.

Technically speaking, an innings is essentially a list of balls played; all other information can be derived from that. (Note: It could also be a list of overs but it was simpler to skip that layer). This derived information includes (but is not limited to):

  1. Runs scored by the batting team
  2. Wickets fallen of the batting team
  3. Batter innings, i.e., scores of all batters
  4. Bowler innings, i.e., bowling figures of all bowlers

Batter innings and bowler innings form the building blocks for all player-centric statistics in cricket.

An innings comes to an end when any one of the following happens:

  1. The quota of overs is completed (in case of limited overs)
  2. The batting team loses all wickets
  3. The batting team has scored the required runs (while chasing)
  4. The batting team declares

To support dynamic teams (the most common form when cricket is played recreationally), the app does not take into account the 2nd condition. To accommodate the same, the user may choose to declare the innings once all wickets have fallen. Once support for unlimited overs is added, the process of declaring an innings will change.

Batter Innings

A batter's innings, also called a knock, consists of a list of balls played by that batter. Using this, we can derive the following data:

  1. Runs scored
  2. Number of balls faced

Using the above data, the following statistics can be calculated:

  1. Strike rate (runs scored)รท(number of balls faced)

Bowler Innings

A bowler's innings, also called a spell, consists of a list of balls delivered by that bowler. Using this, we can derive the following data:

  1. Number of overs (or balls) bowled
  2. Number of wickets taken
  3. Runs conceded
  4. Maidens bowled

Using the above data, the following statistics can be calculated:

  1. Strike rate (number of balls bowled)รท(number of wickets taken)
  2. Average (runs conceded)รท(number of wickets taken)
  3. Economy [(runs conceded) * (number of balls per over)]รท(number of balls bowled)

โšพ๏ธ Ball

A ball is the most atomic unit for scoring a cricket match. It consists of the following data:

  1. Bowler
  2. Batter
  3. Runs scored
  4. Wicket, if any
  5. Extra, if any

Once this data is obtained for every ball of the match, the score as well as result (if the match is completed) can be derived.

๐Ÿคพ Player

A player is needed to play any sport. Players in cricket take up the role of a batter, bowler and fielder. Since players contribute in more than one way, tying together their statistics provides a handy way of representing a player's career performance.

As it stands, you can create as many players as you like but deleting a player is not possible. This is because if a player has been part of even a single match, deleting that player is not possible, as the match cannot have a non-existent player.

TODO: This section will be expanded.

๐Ÿ“Š Statistics

Once the above information is consolidated, statistics can be generated.

TODO: This section will be expanded


๐Ÿ“ฑ Using the app

Home Screen

The Home Screen consists of the following tabs:

  1. Ongoing Matches
  2. Players
  3. Statistics
  4. Settings

A new match can be created using the โจ button located at the center of the Bottom Navigation Bar.

Ongoing and Completed Matches

This tab displays a list of all matches that are ongoing, i.e., have been created but not completed. It is a handy view of all matches that are being played at the moment. It might seem unnecessary for now, but once online syncing is added, a user will be able to see all the matches that are available to them.

Similarly, the next tab displays a list of matches that have been completed.

Every match is represented by a tile displaying the scores of both the teams participating in the match. Clicking a tile will open a new page depending on the status of the match. These pages correspond to the lifecycle of a match, which is as follows:

  1. Create a Match
  2. Toss
  3. Initialize an Innings
  4. Match Interface
  5. Scorecard

Needless to say, every match in the Completed Matches section will directly open its scorecard.

Long-pressing any match tile will bring up a menu where you can choose to:

  1. Rematch โ€” Quickly create a new match with the same teams. Note that this new match will be completely unrelated to the selected match.
  2. Delete โ€” Irreversibly delete the match from storage. Please understand the consequences of this action: ALL STATISTICS FROM THIS MATCH WILL BE DELETED FOREVER! Hence, it is highly recommended to never delete matches unless absolutely necessary.

Create a Match

A match is played between two teams. These teams are (conveniently) called Home Team and Away Team.

Clicking on either the Home Team or Away Team tile will take you to the Team Creation page. On this page, you can choose your team's name, short name, captain and squad. On tapping the Captain or Add to Squad tile, you will be taken to a list of players. Here, tap the desired player or create one if needed.

For example, if I was creating Mumbai Indians, I would have the following data:

  1. Name: Mumbai Indians
  2. Short Name: MI
  3. Blue
  4. Captain: Rohit Sharma
  5. Squad: Jasprit Bumrah, Suryakumar Yadav, Ishan Kishan, Cameron Green, Tim David etc.

(Note: The captain is always part of squad. No need to add them again.)

Toss

Every cricket match starts with a toss. A toss is a simple procedure where one captain wins and chooses to either Bat or Field (Bowl) in the first innings. While not necessarily crucial to statistics, the toss can play an important part in the result of the match, making it a valuable piece of information to store.

Select the winning team and their choice. It's as simple as that.

Traditionally, tosses have been conducted by flipping a coin, although recreational matches may feature "Odd or Even" or "Stone-Paper-Scissors" (also called "Rock-Paper-Scissors") between the captains. In the future, a Conduct Toss feature might be added to the app, that will flip a virtual coin.

Initialize an Innings

To initialize an innings, select the opening pair from the batting team and the opening bowler from the bowling team. Don't worry if there's an error, these can be changed on the next screen.


Match Interface

This is where the magic happens.

On the top, you can see the Score Summary in the form of two tiles representing the Home Team and Away Team. Depending on which innings is being played, the score Runs/Wickets is displayed for the batting team and the overs bowled Over.Ball is displayed for the bowling team. Tapping on the Score Summary will take you to the match's scorecard.

Run Rate Pane
  1. For the first innings shows the Current Run Rate (CRR) and the Projected Score
  2. For the second innings shows the Current Run Rate (CRR), Runs Required and Balls Left. Tapping on the CRR box will toggle it to display the Required Run Rate (RRR) instead.
Players in Action

Next, we have the Players In Action pane, which represents the two batters on the pitch and the bowler who is currently bowling. The two batters are represented as tiles laid out vertically, directly below their team's tile as in the Score Summary header. Similarly, the bowler's tile is placed vertically below the fielding team's tile. In other words, players are of the Home Team are always on the left while players of the Away Team are always on the right, regardless of which team is batting in the ongoing innings.

The Batter Tiles serve an important purpose โ€” selecting the player who is on strike. Usually, this is handled automatically โ€” strike is rotated for odd number of runs and at the end of an over. However, there are possibilities of rules being altered and a '1D' or 3D' being added, in which case the strike will have to be changed manually. The score of each batter is displayed on the tile. For more details on the score, you can always open the Scorecard.

Long pressing a Batter Tile will allow you to replace the batter only if the said batter has not lost their wicket and has not faced a single ball. This functionality exists to fix any human error while initializing an innings. To retire a batter, use the Add Wicket option.

Long pressing a Bowler Tile will allow you to replace the bowler mid-over. Please note that replacing a bowler will NOT skip or restart the over. Just like international matches, the over will continue to be bowled by a different bowler. If you want to restart the over with another bowler, use the Undo button found in the Submit Input pane.

Recent Balls

Next in line is the Recent Balls list, where the latest balls bowled are displayed for convenience. The number of balls visible depends on the screen size of the device. Clicking on this list will take you to the Innings Timeline. The Recent Balls list follows the same scheme as the Innings Timeline, so read that for more information.

To demarcate the beginning of an over, its first ball has its index in the bowling team's colour.

End Innings and Add Wicket

The next row consists of two mostly unrelated interactions:

  1. The End Innings button, which can also be called the Declare button. Clicking this will, well, do nothing. You will see a small message pop-up which tells you exactly what you have to do โ€” press and hold this button if you really want to end (or declare) the innings. The long-press instead of a tap is to prevent an accidental declaration (oops!).
  2. The Wicket tile, which lets you add a wicket to the ball that is currently being entered. On tapping this tile, you will be taken to a pretty self-explanatory screen where you choose the kind of dismissal (bowled, LBW, run-out etc.) and the players involved in said dismissal. To clear a wicket that has been selected, press and hold this tile before adding the ball.
Extra Selector

The first section toggles between Batting Extras: Bye and Leg Bye. For the uninitiated, a Bye is a run scored by the batting team without a batter getting their bat on ball. But if they manage to get their body on ball before scoring the runs, it's called a Leg Bye. Note that in either case, even though the runs scored are awarded to the batting team, they aren't awarded to the batter.

Next up, we have the Event toggle which serves a very crucial purpose โ€” recording an event that takes place without a ball being bowled. A very common case is the run-out by the bowler at the non-striker before bowling the ball, as sensationalized by Ravichandran Ashwin when he dismissed Jos Buttler. This also comes in handy when you want to retire a batter.

The last section deals with Bowling Extras, the infamous No Balls and Wides. Do note that while entering this data you are NOT supposed to select the runs awarded to the batting team due to a Bowling Extra. If no runs are scored by the batting team on a No Ball or a Wide, choose 0 runs on the Run Chooser.

Run Selector

It's a list of number from 0 to 6 that represent the number of runs scored on the ball that is being entered. Numbers '4' and '6' are treated specially, since they represent the ever-so-famous boundaries loved by fans of cricket. As it stands, there is no distinction between scoring a four or actually running four runs.

As mentioned earlier, DO NOT select the runs awarded due to a Bowling Extra such as a wide or no ball. Those penalty runs are added automatically.

Submit Input

These two buttons do exactly opposite actions

The first one, Undo, as the name suggests, will undo the previous ball, i.e., make it as if it was never played. It is removed completely. Discarded. Shredded. Destroyed. Obliterated. As such, you can't "Undo" an "Undo", so don't undo what you don't want to undo. Don't request for a "Redo" feature, just be more careful. (Or do request, maybe I am underestimating the requirement.)

The second button takes on various forms depending on the situation.

  1. In most cases, it is an Add Ball button, that submits the data entered from Run Selector, Extra Selector and Add a wicket. This will cause the ball to be added into the innings. As result of this, the scores for both the teams and all the players involved will be updated.
  2. When an over is completed, it is a Select Bowler button. On clicking, you will be taken to the bowling squad to choose the next bowler.
  3. When a wicket falls, it is a Select Batter button. On clicking, you will be taken to the batting squad to choose the next batter.
  4. When the quota of overs is completed, or when the target for the second innings is achieved, it is an End Innings button which will act the same as long-pressing the End Innings button.

Match Scorecard

The Scorecard screen starts with a simple view of the overall scores of both the teams across all innings played all the way at the top.

If the match is completed, you will see the result of the match right below. This is skipped for Ongoing Matches.

Next, for each team's innings, a list of batter innings is displayed. For each Batter Innings, the following information is displayed from left to right:

  1. The batter's photo, if any
  2. The batter's name
  3. Right below the batter's name, their wicket status
  4. The batter's score - Runs, balls faced
  5. The batter's strike rate
  6. The number of fours and sixes hit, displayed inside circles of the respective colour

Next, we have a list of players from the batting team who did not bat.

Next, we have a table displaying the Fall of Wickets. Every row marks the index at which a wicket fell, the score at when that wicket fail, the batter who lost their wicket and their wicket's details.

Next, the list of bowler innings is displayed. For each Bowler Innings, the following information is displayed from left to right:

  1. The bowler's photo, if any
  2. The bowler's name
  3. The number of overs bowled
  4. The number of wickets taken, displayed inside a red circle
  5. The number of runs conceded
  6. The bowler's economy

Finally, a View Timeline button takes you to the Innings Timeline


Innings Timeline

This screen displays a vertical, chronological timeline of balls bowled in the innings, with the last ball at the bottom and the first ball at the top.

The timeline is segmented into overs.

Each over's segment starts with the Over's ordinal index. Each row represents a ball displaying the following data from left to right:

  1. The timestamp (in local time) at which the ball was bowled
  2. The Ball Symbol
  3. The Bowler and the Batter
  4. Wicket, if any
Ball Symbol

I really couldn't come up with a better name, but it's the shorthand representation of the ball with the following data

  1. The runs scored, denoted by a number in a circle
  2. The Over.Ball index of the ball, displayed directly below the run's circle

The circle's colour and the border of this circle gives a quick look at what transpired using the same colours as seen in Colour Lookup.

The circle's colour represents the boundary or wicket that transpired on the ball. The border represents a Bowling Extra and is absent if the ball is a legal delivery.


Players Page

A simple management page where you can create and edit players.

Creating a player is simple: Tap the Add a Player tile and fill in the form with basic details such as Name, Batting arm, Bowling arm and style. You can also add a picture if you like (recommended!).

Note: Currently, deleting players is not an option because. Why? Here's a detailed explanation: Deleting a player that has played a match will cause disastrous consequences like a non-existent player bowling a ball or hitting a six. That's a nightmare. To avoid this, for now, players can't be deleted once created.

Statistics Page

This is where you will see the statistics of all your players.

Right now, the page has been disabled.


๐ŸŽจ Colour Lookup

With respect to a Ball:

  • indigo Indigo for a Four
  • ruby Ruby for a Six
  • red Red for a Wicket
  • yellow Yellow for a No Ball
  • white White for a Wide

The colours available for assigning to a Team:

  • blue Blue
  • orange Orange
  • grey Grey
  • green Green
  • cyan Cyan
  • brown Brown
  • yellow Yellow
  • violet Violet

๐Ÿ”ฎ In the Future...

  • Add screenshots to README.md
  • Add online syncing
  • Add statistics and filters
  • Add Settings and Customizations
  • Add support for Test Matches (Unlimited Overs)
  • Add Tournaments and Series
  • Track multiple sports

โœ๏ธ Authors

  • @PlayPratz - Ideation, Documentation and App Development

scorecard's People

Contributors

playpratz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.