re:WCYDWT – Will It Hit The Corner? – Find Out With Python!

Thanks to Dan for posting a great setup and a problem that turned out interestingly. I worked the problem on paper last night. Then this morning, I came in and re-worked the problem with a few students, and finally read Alex’s algebraic solution. The handout I made from last night is below.

Ws Office Boxcorner

After some time with Alex’s formula I wasn’t getting things to work out (probably a problem of choosing between 63/64 and 79/80). At any rate I really wanted something concrete to test solutions. I bumbled around a bit in python and came up with a program to model different sized grids and logo paths. The program colors in the paths and stops when a corner is hit.

Here’s an overview.

Running the Software on a Mac:

This is easier than a PC because Mac’s come pre-loaded with python already installed. Follow these steps to get the program running.

  1. Download the file and save it to the “Macintosh HD” folder.
  2. Open up a terminal window (hold command and hit spacebar, then type “Terminal” or navigate to your Applications folder from Finder, open Utilities, and double click on Terminal.)
  3. In the Terminal window you’ll have to change directories to get back to the root (which is the Macintosh HD folder where the office-grid file should be)
    • To do this, type cd .. then Enter until the directory stops changing.
    • Then type ls Enter to view the contents of the current directory. You should see the “” file
  4. Type: python and hit Enter to run the program.
  5. To run the program again, you must first make sure to close the graphic window, then enter python in the Terminal and hit enter.

Running the Software from on a PC

  1. Install python (choose the version that fits your operating system (32 or 64 bit)
  2. Download the file and save it to the root of the “C:\” drive.
  3. Open a command terminal. If you have XP, type cmd Enter in the Run dialog of the Start Menu. See here for info on Vista. On Windows 7 hold Shift and left-click any folder with the mouse and choose “Open Command Prompt Here.”
  4. Type “cd c:\” from the command prompt to change directory to the root of the C-drive.
  5. type “python” Enter


5 Responses to “re:WCYDWT – Will It Hit The Corner? – Find Out With Python!”

  1. Ella Rogers February 24, 2010 at 6:20 am #

    You might find this useful too for learning maths in a new unique way:

    My students are totally engaged when I include online math games within a lesson or as homework. The repetition and association that games = fun really helps them capture the subjects. My class really enjoys a new site with Algebra, Geometry, Quizzes, etc.

  2. Nick February 27, 2010 at 5:30 pm #

    Ella thanks I just tried Ice Ice Maybe, it’s good to have something like this in the back pocket.

  3. Shoes For Plantar Fasciitis April 15, 2014 at 11:28 pm #

    Tremendous issues here. I am very glad to look your post. Thank
    you a lot and I am having a look ahead to contact you.

    Will you please drop me a e-mail?


  1. dy/dan » Blog Archive » Nick Hershman’s Follow Up: Will It Hit The Corner - February 13, 2010

    [...] Hershman is running laps with this one. Check the blog post or the screencast, in which he explains how he built a Python script around an algorithm from the [...]

  2. Divide By Zero » Blog Archive » How To Teach: Will It Hit The Corner? - February 17, 2010

    [...] Subscribe « re:WCYDWT – Will It Hit The Corner? – Find Out With Python! [...]

Leave a Reply