8 Are you faster than a superhero?

 

This chapter covers

  • Calling functions within loops
  • Selecting a random delay
  • Calculating reaction time of the player
  • Using floats to hold accurate times
  • Using casting to change data types from strings to decimals

Did you know that the fastest possible conscious human reaction takes around 0.15 seconds? This means that, on a lovely warm Summer’s day when someone is trying to squirt you with a water hose and you want to dodge the cold stream of water, the fastest that you would react and begin to move is within 0.15 seconds. However, a quick Google search returns that most reaction times are around 0.2 seconds. Because the signal does not have to go via the brain, unconscious, or reflex actions, are much faster: around 0.08 seconds.

Creating the project

Setting up the folder

Importing the modules

Creating the variables

Creating the main functions

Creating the start() Function

Creating the timer() function

Creating the Stop function

Building the main app

Running and Testing the GUI

Other things to try

Changing the speed of the delay and the timer

Displaying the fastest reaction time

Summary