Coding in the Classroom | Coding and sports data

Using coding to make decisions in sports
By: Steven Floyd

The use of data to draw conclusions and make decisions provides a rich and valuable context for the development of coding and mathematics skills. In addition, these are skills that are, and will be, required in many aspects of research and professional work.

Researchers Sanford and Naidu (2016) believe that almost “every avenue of science, engineering, and general business employs digital computation”.  It is with computation that we can extract “knowledge from vast quantities of data, or mathematical solutions unavailable through other means” (Sanford & Naidu, 2016, p. 1)

Computation has proven to be so productive for advancement of science and engineering that virtually every field of science and engineering has developed a computational branch.
In many fields, the computational branch has grown to constitute the majority of the field. For example, in 2001 David Baltimore, Nobel Laureate in Biology, said that biology is an information science.” (Denning, 2017, p. 14)

Coding in our K-8 Classrooms

The grade 8 Ontario Mathematics Curriculum now includes two coding expectations related to the use of data to make decisions, and the area of sports analytics can serve as a powerful context in which to investigate these expectations:

C3.1 – solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions
C3.2 – read and alter existing code involving the analysis of data in order to inform and communicate decisions, and describe how changes to the code affect the outcomes and the efficiency of the code

Over the last few years, two educators from London have been working with intermediate students in this area. In the fall of 2017, Richard Annesley, a colleague and friend, asked if I would be interested in learning more about a project he was starting at his elementary school. Richard had been speaking to Luigi Sorbara, whose children attend Rich’s school.  As a computer scientist, Luigi believes it is crucial to increase young people’s exposure to coding and computer science.

I had the pleasure to meet with Luigi and learned that he is a Basketball Statistician and Application Developer.  He had been thinking about ways to introduce children to coding and mathematics in an authentic and meaningful way using block-based coding.  He shared his ideas with myself and a number of educators within the school.  We were amazed and excited at the potential of this project, which involves a cross-curricular approach.

Luigi developed a Scratch program that reads in data related to 1000 shots taken by Steph Curry over a two-season period. The program displays each shot, as either a make or a miss, on a basketball court diagram created as a backdrop in Scratch.

After being given a copy of the program, and playing around with the statistics of a few other players, it was clear that this project idea would have value in terms of bringing the ideas of coding, mathematics, data manipulation and drawing conclusions from data to students in younger grades, not to mention the potential to connect these areas to physical education and sport.

Luigi has since shared another program in Scratch that plots Clayton Kershaw’s Game 7 World Series pitch locations. He has also been working with intermediate students as they use Python to process and display sports performance data.

I believe that programs like this will be able to capture students’ imaginations and motivate them to want to draw conclusions from the data. Perhaps students will want to create programs that can record and analyze data from other sports or even other fields.

Imagine students creating a program to keep track of opponent’s penalty shot location.

Richard and Luigi are continuing their work with this program and with finding ways to bring CT to younger students. They have even designed a coordinate system for their gymnasium floor in order to record the locations of the made and missed shots:

I don’t believe that the value of such projects is solely in the final conclusions drawn from the data. The real value is in having students attempt to develop algorithms or queries that can be automated and executed by the computer. This encourages clarity of thought, precision in instructions and assumption avoidance.

Coding and mathematics will play a part in most fields and a wide variety of areas in our lives. Projects such as this can help students understand the importance of data and facilitate the development of skills needed to draw important conclusions from this data.

In addition, these types of projects allow students to engage in topics such as the Internet of Things and Big Data. Students become aware that a tremendous amount of data already exists, and of course much more is generated by the minute.

Providing students with opportunities to engage with this data and to think computationally at a young age will help them to:

  1. Identify what type of data is valuable and should be recorded;
  2. Determine what type of queries should be made in order to draw conclusions from the data;
  3. Design algorithms that allow for those queries to be implemented.

Consider the following questions that students might investigate with data:

  • Does it make statistical sense for Steph Curry (or any player) to shoot a long two-pointer?
  • What about a mid-range jumper? Does he shoot very many? Should he?
  • Should basketball players step back and take a three-point shot rather than a long two-pointer? How would you figure this out?
  • Should players shoot any two pointers at all?
  • What two-point and three-point shooting percentages would be required to justify shooting only three pointers?
  • Can you create a coordinate system in your gym that would allow you to record the location of made and missed shots?
  • Can you create a program that would allow a team to efficiently record the shooting data for a player during a live basketball game?
  • Can you create a program that would allow a team to efficiently record the shooting data for their whole team?
  • Can you use your program during a school game? A game broadcasted on TV? A live game?
  • Can you create a program that displays the shooting data in a user-friendly format?
  • Can you determine what data might be valuable to record for other sports? Hockey? Baseball? Volleyball?
  • What types of conclusions could you draw from this data?
  • Can you create a program to record or display the data for this sport?
  • Can you create a program to store data related to a Scissor, Paper, Rock tournament in your class?
  • Can you identify patterns in the Scissor, Paper, Rock data? Can you predict a person’s next move based on this data? How reliable is your prediction?
  • Can you create a program to store data related to the colour of cars in the parking lot, or the number of cars that come to a complete stop at the stop sign outside your school? Can you analyze this data in order to draw conclusions?
  • Can you create a program to store data related to the types of trees in your school yard? Can you create a grid system that will allow you to identify the locations of these trees? Can you plot these locations on school yard background created in Scratch?
  • Can you create testing plans that would allow you to effectively test and debug your programs?

References:

A. V. Aho, “Ubiquity symposium: Computation and Computational Thinking.” Ubiquity, Volume 2011, Issue January, 2011.

Denning, J. Computational Thinking in Science, American Scientist. Available at https://www.americanscientist.org/article/computational-thinking-in-science

Denning, J. Computational Thinking in Science, American Scientist. Available at https://www.americanscientist.org/article/computational-thinking-in-science

Sanford, J. F. & Naidu. 2016, Computational Thinking Concepts for Grade School. Contemporary Issues in Education Research. Volume 9, Number 1. First Quarter 2016.

Richard Annesley (@richannesley) is a grade 6 teacher at St. Theresa Catholic Elementary School in London, ON. He works on a number of projects related to coding and computational thinking, but is also interested in having students participate in experiential learning initiatives to improve their communities. He does not have a computer science background but enjoys the humbling challenge of learning alongside and from students. He believes that computational thinking provides students with an outlet to problem solve and use their creativity.

Luigi Sorbara (@teachcodecreate) is a Basketball Statistician and Application Developer with the Boston Celtics and a Waterloo University Grad in Applied Mathematics and Scientific Computation.  He has enjoyed the challenge of bringing computational thinking and coding into the classroom through sports-related data.

Scroll to Top