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

Lesson 2 (Rebased, touched) #15

Closed ahmadia closed 10 years ago

ahmadia commented 10 years ago

Hi Folks,

I've cleanly rebased @agolding718's work onto where it should have forked from master so that it's independent of his Lesson 1 work. I've also done a first pass through at editing.

@agolding718 - this is good work! Sorry I couldn't give you feedback earlier, but I like the way this lesson is shaping. I think we should try to get this merged in by mid-week, and defer major improvements (animating the robot motion, for example), to other pull requests.

I think we may need to introduce a slightly simpler function up front for them before we give them the robot control function. Let's see how Lorena and the other students feel about it, but the ingredients we are introducing are:

I think we should at least give them a function definition with parameters and return statements to understand before we introduce the logic of control statements. One option would be to give an example of a robot that mindlessly just goes forward. Another would be to define a function that does simple math (like converting Fahrenheit to Celsius).

ahmadia commented 10 years ago

Notebook preview is here: http://nbviewer.ipython.org/github/barbagroup/JITcode-MechE/blob/lesson_2_fixes/lessons/02_Lesson02_ConditionalsAndFunctions.ipynb

gforsyth commented 10 years ago

@agolding718 , these look good and they're coming together well.

I'm in agreement with @ahmadia that we might need to lead them in a little softer to defining functions.

We could have a little side-notebook -- we did something like that with the 12 steps notebooks and had a few different functions, one that just returned the sum of two inputs and the other that printed out the fibonacci sequence up to the inputted nth value.

Another option might be to change (initially) the rover planning function to have only one return statement, something along the lines of

def student_func(front_sensor):
    if front_sensor == 'hazard':
        decision = 'turn right'
    else:
        decision =  'go forward'

    return decision

which might be easier for them to parse at first, and then after they've played around with something like that, use your original (and better) function to demonstrate that return statements can be inside conditionals.

We also need to figure out a better way to display the progress from rover_planning_1.py, the scrolling is a bit awkward. We can do it as an animation, or a big gridded subplot.