Newton's Gravity as Coded by an 11yo Student - theCoderSchool Blog

Newton’s Gravity as Coded by an 11yo Student

Sometimes what the students do at our school amazes me, but one app has always stuck out in my mind.  We have a 13yo student who I’ll call LN, who’s been with us since we opened.  When he was 11, he created this incredible app he calls Gravity Crash.  LN is a big fan of physics, and it happened that his Code Coach was too – and so some pretty amazing coding ensued.

LN’s game looks and plays like a standard billiards game (which in itself is already quite hard to code in Python).  But instead of hitting the cue ball, you create what he called “gravitational anomalies” (I guess he was a Start Trek TNG fan too!) that sucks the cue ball towards it (and orbits it, if placed correctly), using newtonian physics formulas.  What?!

Take a look here, and be sure to widen the game screen so you can see the entire billiard table.  You can also open Gravity Crash in a new window.

 Newton's Law of Universal Gravitation
Newton’s Law of Universal Gravitation

 

So I want to point out that, even as a coder of 20 years, some of this would be mind-boggling for myself to write.  If you’re not a coder, just scroll through the code and you’ll be blown away.  If you’re a coder, check out how he handles collisions starting on line 171 (yep, granted, he needed some help on the vector and collision math!).  And if you’re a physicist, check out line 234, my favorite.  Break down the component parts, and [gasp!!], you have Newton’s Law of Universal Gravitation.  Let me sum that up for you, an 11 yo coded a pretty complex game in Python, and then decided to use Newtonian formulas to simulate gravity.   Niiiiiiice.

Now mind you, in our model, we have a Code Coach, directly mentoring our students – so building the app wasn’t completely unaided.  Moving the balls, collisions, even just setting up the triangle, requires some really good math knowledge.   But LN, again, an 11yo, understands how most of the code works, and coded a large part of it.  Think about how much coding AND math experience he gained coding this app.  Mind.  Blown.

via GIPHY

Published
Categorized as Coder Blog

Hansel is the Founder & CEO of theCoderSchool and has been at the heart of it ever since its inception in 2013.

Private+Semi-Private Coaching

Virtual Learning

Coding Classes

Robotics

Python

Scratch

Video Game Coding



What is theCoderSchool? We are an after-school drop-off (and virtual) program for kids learning to code - a coding school! There's after-school kung fu. There's after-school music lessons, sports, art, tutoring, Chinese, you name it, it's out there. But coding for kids? We're among the first of many, and the largest in Silicon Valley with more locations on the way around the country. The future will be ever more dependent on technology so let's get our young generation ready. Learn to Code, Change the World®.

For questions about partnerships, curriculum, schedule, camps, or other operational inquires, please contact your nearest school.
For national franchise questions only, email us at info@thecoderschool.com. Please include the city/state you're writing from.

copyright 2014-2022, the Coder School San Francisco, LLC. All Rights, Alright? Don't forget our privacy policy. Find out who we are or like us on facebook.