CSC 161 Grinnell College Spring 2018
Scribbler 2
CSC 161:
Imperative Problem Solving and Memory Management
Scribbler 2
Course Home References Course Details: Syllabus, Schedule, Deadlines, Topic organization MyroC Documentation Project Scope/
Acknowledgments

Note: Although this course is well developed,
expect adjustments in some details as the semester progresses and the course evolves.

Organization of Course into Segments and Sessions


Warning: Undefined variable $segID in /home/walker/public_html/courses/161.sp18/MyroC-support-scripts/show-topics.php on line 40

Warning: Trying to access array offset on value of type null in /home/walker/public_html/courses/161.sp18/MyroC-support-scripts/show-topics.php on line 132
Course Segment Session ID Session Title Session Resources Session Notes
module 000: Getting Started with Linux, C, and the Scribbler 2
1: intro.Overview of CourseCourse Overview
  • Course Content Overview
  • Module Overview
Demo
  • scribbler-espeak.c
  • Single-robot motion, eSpeak, and beeping: single-robot-demo.c
  • avoid-obj.c
Reading
  • Pair Programming
  • Workstation Setup
Utility program
  • set-robot-name.c
Placing this course in context
2: labLinux/Mac OS X BasicsReading
  • Basic Linux Commands and Capabiities
  • Introduction to Emacs by Marge Coahran (Lab exercises optional for class preparation)
review of basic Linux commands and setting up .bashrc
3: labElementary C ProgrammingExample
  • quarts.c: A first program in C
  • temperature conversion, C version
  • temperature conversion with averaging
  • temperature conversion, Scheme version 1
  • temperature conversion, Scheme version 2
Reading
  • Getting Started with C Programming
basics of C syntax, editing, compiling, and running
4: labMore C with eSpeak and MakefilesExample
  • eSpeakExample1.c
  • eSpeakExample2.c
Reading
  • More Linux (Background processes, autocompletion, manual, printing)
  • Still More Linux (Files and File Permissions)
  • Intro. to eSpeak and Makefiles
  • eSpeakPackage.h
  • Sound on MathLAN Workstations
additional Linux commands, use of eSpeakPackage
5: labUsing the Scribbler 2 Robot and Mechanics of Basic InputDemo
  • beep-move-demo.c
Example
  • pirates.c
  • spirit-song-full.c
  • earsHangLow.c
  • spirit-song.c
  • quarts-rev.c
  • quarts-gallons.c
Reading
  • Programming with the Scribbler 2
  • Mechanics of Basic Input
  • MyroC documentation
program structure for MyroC
6: labIntroduction to Program OrganizationReading
  • Introduction to Program Organization
Introduction of include files; function to organize work no parameters, no return; incremental software development
7: projectProject: Program a SongExample
  • scribbler-espeak.c
module 001: Conditionals, Loops, and Scribbler 2 Motion
1: intro.Overview of conditional statements and control structuresReading
  • Overview of conditionals, loops, and Scribbler 2 motion
2: labTypes, Variables, and CastingExample
  • quarts.c
  • printf-formatting.c
Reading
  • Types and Variables
3: labConditionals with the Scribbler 2Example
  • smallest3-1.c
  • smallest3-2.c
  • smallest3-3.c
  • smallest3-4.c
  • integer-words.c
  • light-switch.c
  • sensor-use.c
  • light-sensor-example.c
  • conditional-lightSensor-1.c
  • conditional-lightSensor-2.c
  • light-sensor-switch.c
  • blocking-nonblocking.c
Reading
  • Boolean Values and Expressions
  • An introduction to Conditional Statements in C
  • Scribbler 2 Sensors and Motion
  • Diagram of Scribbler 2 sensors and function calls
use of sensors in controlling the Scribbler 2
4: labLoops and Scribbler 2 MotionExample
  • ice-cream-truck.c
  • robot-dance.c
  • while-obstacle.c
  • do-while-beep.c
  • 3-loops.c
Reading
  • Reading on Loops
combining sensors, motion, and repeated actions
5: labSimple Simulations and More Program Management: Functions, Value Parameters, Assertions,Example
  • couple-1.c
  • couple-2.c
  • couple-3.c
  • couple-4.c
  • couple-5.c
  • couple-6.c
  • quadratic.c
  • coins.c
  • yoyo-program.c
Reading
  • Introduction to Simulation
  • Program Management with Functions and Assertions
introductory simulations and functions with and without value parameters and return values
6: projectProject: Robot Actions— — —
module 010: Functions, Addresses, Arrays,and Testing
1: intro.Function Prototypes and an Overview of Functions, Arrays, and AddressesReading
  • Arrays, Functions, Testing and Arrays: An Overview
2: labThe Run-time StackExample
  • pi-sim.c
  • value-param-example.c
  • add2c
  • couple-6.c
  • lab-value-param.c
  • homework-value-param.c
Reading
  • The Run-time Stack
storage allocation within the run-time stack
3: labFunctions with Addresses as ParametersExample
  • func-sphere.c
  • perim-area-1.c
  • perim-area-2.c
  • perim-area-2a.c
  • func-exercise-1.c
  • func-exercise-2.c
  • quadratic-two-roots.c
  • func-exercise-3.c
Reading
  • Functions with Addresses as Parameters
experiments with values and addresses as parameters
4: labArraysExample
  • max-min.c
  • array-scale.c
  • array-move.c
  • photographer.c
  • max-array.c
Reading
  • Reading on Arrays
array storage, base addresses, indices
5: labFunction Pointers, Parameters, and Arrays, Program Correctness, and TestingExample
  • circle-cirum-area-1.c
  • circle-cirum-area-2.c
  • circle-cirum-area-3.c
  • func-parm.c
  • func-parm-arrays.c
  • motors-test.c
  • object-avoid.c
  • follower-test.c
  • rand-beep.c
  • get-ir.c
Reading
  • Function Pointers (Optional)
  • Correctness and Testing
notes on pre- and post-conditions
6: projectProject: Uninterpretable DanceExample
  • darts.c (with random number generator)
project integrates all elements of C to this point
unit : Data Representation
1: intro.Overview of Number RepresentationReading
  • Representation of Numbers: Unit Overview
2: labRepresentation of IntegersReading
  • Binary Representation of Integers
  • Representation of Signed Integers
Utility program
  • Program integer-sizes.c to display sizes of integer data types
  • Program integer-ranges.c to display ranges of integer data types
  • Program integer-rep.c to display binary representations of integers
  • Program integer-rep.ss (in Scheme) to represent binary representations of integers
3 representations of integers
3: labRepresentation of Floating-point NumbersReading
  • Binary Representation of Floating-point Numbers
IEEE floating-point representation
4: labConsequences of Data Representation and Use of the gdb DebuggerReading
  • Consequences of Data Representation on Programming
  • Debugging with GNU Debugger: a GDB Tutorial by Samuel Huang from the University of Maryland
5: labMachine-level ExplorationsReading
  • Machine-level Operations, Bit Manipulation, and Unions
bit-level operations
module 011: Characters, Strings, and I/O
1: intro.Overview of Characters, Strings, and I/OExample
  • counting-chars.c
  • char-example.c
Reading
  • Characters, Strings, and I/O: An Overview
2: labCharacters and StringsExample
  • character-example.c
  • io-NATO.c
  • string-example-1.c
  • string-example-2.c
Reading
  • Characters in C
  • Strings in C
character coding, string storage and functions
3: labData input with scanfExample
  • scanf-example-1-2.c
  • scanf-example-3.c
  • scanf-example.c
  • scanf-char.c
  • i-o-example-1a.c
  • i-o-example-1b.c
  • i-o-example-2.c
  • i-o-example-3.c
  • i-o-example-4.c
Reading
  • Reading data with scanf
Use of scanf and format strings for reading
4: labCharacter-by-Character Input and OutputExample
  • option-prog-1.c
  • option-prog-2.c
  • scanf-s-test-1.c
  • scanf-s-test-2.c
  • get-3-char.c
  • getchar-example.c
  • input-examples.c
Reading
  • Character-by-character Input and Output
Use of getchar, putchar, printf
5: projectProject: Robot Follows Typed Commands— — —
module 100: Grouping Data and Image Processing with the Scribbler 2
1: intro.Overview of Grouping DataReading
  • Grouping data and image processing with the Scribbler 2: An Overview
2: labGrouping Data: StructsExample
  • square-move-1.c
  • square-move-2.c
  • square-move-3.c
  • square-move-4.c
  • square-move-5.c
  • square-move-6.c
  • test-scores-1.c
  • test-scores-2.c
  • test-scores-3.c
Reading
  • Reading on Structs
syntax, semantics, and applications of structs
3: labGrouping Data: 2-dimensional ArraysExample
  • city-precipitation.c
  • 2D-array.c
Reading
  • 2-dimensional arrays
4: labImage Storage and ProcessingExample
  • picture-splice.c
  • 2D-array-with-proc.c
  • 2D-array.c
Reading
  • Image Storage and Processing
storage of pixel data in a struct with a 2D array
5: labInsertion SortExample
  • insertion-sort-proc1.c
  • insertion-sort-proc2.c
  • insertion-sort-proc3.c
  • 2D-1D-array.c
  • insertion-sort-picture.c
Reading
  • Insertion Sort
6: projectProject: Picture Suite— — —
module 101: Dynamic Memory, Pointers, and Linked Lists
1: intro.Pointers and Dynamic MemoryReading
  • Overview of Dynamic Memory
2: labMemory Allocation and PointersExample
  • malloc-example.c
  • read-avg-1.c
  • read-avg-2.c
  • scribbler-movie.c
Reading
  • Dynamic Memory Allocation
introduction to pointers and dynamic memory
3: labScheme-like Lists in CExample
  • scheme-lists.c
  • computer-science-example.c
Reading
  • Scheme-like Linked Lists in C
insertion and deletion at front of linked lists
4: labLinked-lists in CExample
  • string-list-example.c
  • namelist.c
Reading
  • Linked Lists in C
basic list operations
5: labLinked Lists for a Movie— — —movie application for lists
6: labProgram Management Header FilesExample
  • namelist.c
  • Makefile
  • scheme-lists.c
Reading
  • Program Management
division of programs into multiple files
7: ProjectProject: Robot Command Sequence— — —
8: projectProject: Music Composition— — —
module 110: Stacks and Queues
1: intro.Abstract Data Types: Stacks and QueuesReading
  • Abstract Data Types: An Overview
2: labStacksReading
  • Stacks
array and linked-list implementations of stacks
3: labQueuesReading
  • Queues
array and linked-list implementations of queues
4: projectProject: Comparing Stack ImplementationsExample
  • stack-project.c
  • approach 1
  • approach 3
  • approach 2
  • approach 4
Reading
  • Stack Storage Results
5: labBash ScriptsReading
  • Bash Scripts
using bash scripts for testing
module 111: Imperative Problem Solving, Robots, and Varieties of Input and Output
1: intro.Overview of Command-line Arguments and FilesDemo
  • Multi-robot motion, eSpeak, and beeping: multi-robot-demo.c
Reading
  • Imperative Problem Solving, Robots, and Varieties of Input and Output: An Overview
2: labCommand-line ArgumentsExample
  • command-line.c
  • string-processing.c
Reading
  • Working with Command Line Arguments
  • Working with Strings
focuses upon arrays of strings and string processing
3: labFile Input and Output with Characters and StringsReading
  • File Streams
basic input of characters and strings
4: labFile Processing Applications (Optional)Example
  • class-tests.dat
  • class-test-averages-1.c
  • class-test-averages-2.c
  • us-cities.dat
  • us-cities-max.c
  • us-cities-media.c
Reading
  • Text Files
practice using stream input from text files
5: projectProject: Robot Parade— — —builds on earlier project for user control of robots