barbagroup / JITcode-MechE

Online learning modules to learn computing in a problem-based context within Mechanical Engineering
MIT License
7 stars 5 forks source link

Alex mar 25 update #20

Closed labarba closed 10 years ago

labarba commented 10 years ago

http://nbviewer.ipython.org/github/barbagroup/JITcode-MechE/blob/alex_mar_25_update/lessons/03_Lessons03_Loops.ipynb

agolding718 commented 10 years ago

http://nbviewer.ipython.org/github/barbagroup/JITcode-MechE/blob/alex_mar_25_update/lessons/04_Lesson04_ModularityandFlow.ipynb

agolding718 commented 10 years ago

http://nbviewer.ipython.org/github/barbagroup/JITcode-MechE/blob/alex_mar_25_update/lessons/05_Lesson05_DataAnalysis.ipynb

gforsyth commented 10 years ago

Hey guys,

I have a few thoughts on formatting. @agolding718 - you mentioned that the code was getting into very long blocks, they definitely need to be broken up. I think as a general formatting point, in the spots where you've written nice, detailed comments about various pieces of code, those should be taken out of the code block and placed in markdown cells. It will help break up the stretches of code and make it generally more readable.

Regarding the rover movement functions, specifically, they seem a bit ungainly. What do you think about something like the following?

card = ['North', 'West','South','East']
pointing = 0 

def turn_right(pointing):
    return (pointing + 1) % 4

def turn_left(pointing):
    return (pointing - 1) % 4

print "Facing %s" % card[pointing]

And we can use that as an opportunity to explain modulus and still walk them through conditionals when it comes to hazard checking.

I think we should also be more explicit about how the rover is 'moving,' e.g., explain that the map is an 8 x 8 grid where position is indicated by [row, column]