Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more.

https://storage.googleapis.com/files.cs-first.com/sports/sports-icon%402x.png

1. Introduction to Variables

Transcript

(upbeat music)

Hi, and welcome to activity six of Google CS First Sports.

In this activity, you'll build a home run derby style baseball game while you learn about the computer science concept called variables.

Variables in computer science are places to store changing values.

For example, in Scratch a variable can keep track of time or the exposition of a sprite.

Most software uses variables to keep track of information.

StatsHub uses variables to compare athletes from different sports and to compare high school players to pros.

IBM SlamTracker keeps track of statistics that can help players and coaches analyze their performances as well as give viewers real-time insight during a match.

These statistics are stored in variables.

Then used in visually appealing graphics.

Additionally, SportVU and Synergy Sports Technology track players' location using cameras.

Then store this data in variables.

Coaches use data to understand their players strengths and weaknesses to create more successful teams.

For example, variables are used to keep track of how fast a player runs or how many times he or she touches the ball.

This project uses a variable in your baseball game to keep track of a baseball player's batting average.

Once you open the startup project, you'll see some extra sprites.

You only need one pitcher and one coach so pick the ones you like and delete the rest.

Alright, here's the game plan.

Open the starter project by clicking the link and sign in.

Then click remix.

Delete the extra sprites.

Then come back to the CS First page to watch the next video.

Instructions
  1. Open the starter project.
  2. Remix the project.
  3. Sign in to Scratch.
Attributions
  • "Wimbeldon Slamtracker" by Wimbeldon (http://www.wimbledon.com/en_GB/scores/index.html)
  • "NBA Player Tracking" by NBA (http://stats.nba.com/tracking/#!/player/)
  • "Statzhub Kurt Kelly Voice Over v5. mov" by KURT KELLY (https://www.youtube.com/watch?v=LAWabZzn16s) -- Licensed by Creative Commons Attribution 3.0 Unported (https://creativecommons.org/licenses/by/3.0/legalcode) -- Video trimmed to needed length, audio removed