Goal Line Technology

Goal Line TechnologyInspired by the football worldcup we came up with our own Python script to implement the goal line technology.

Rules of the challenge:

  • Use Python to display the goal line on the screen as well as the two goal posts.
  • Every time the program is executed it should draw the ball on a random position on the screen.
  • The program should decide if there is a goal or not. There is a goal if the ball has passed the goal line and is between the two goal posts.
  • Tip: You will need to use the random Python library to generate random coordinates for the ball.

    Our first attempt using Python Turtle


    Our second attempt using the processing library


    This version is slightly different. The ball follows the mouse pointer. It turns green if you score a goal or red if the ball is out.

    You will find everything you need to know about the Processing library using this website and you can look at some of these examples to see how it is used.

    Read more

    You can do some research on the Internet to find out how the goal line technology really works. You will find out that there are different types of systems as explained on this page about goal line technologies.

    Share Button
    Posted in Computer Science, Python - Advanced, Python Challenges Tagged with: ,

    Our Latest Book

    Follow this blog