Great job!

All grades have been posted. Do e-mail me directly if you have any questions about your grade breakdown. You were a fantastic class — I hope you enjoyed taking the course as much as I did teaching it (and coming up with labs). Good luck with everything, and have a great break!

Lab 10: Yahtzee, part II (Updated)

Objectives:

Lecture: File I/O

Download the slides here.

Lecture: Hashes

Download the slides here.

Official Yahtzee Instructions

Mirrored here from http://www.hasbro.com/. And here’s the scoresheet I handed out in class.

Lab 10: Yahtzee, part I

Objectives

Lecture: Two Examples

Download the slides here.

Lecture: Methods

Download the slides.

Simulating Blackjack

The code we went over in class to simulate the game of Blackjack can be found at http://github.com/michaelee/cs105/tree/master/examples/lect20_blackjack.rb. Instead of removing the programming shortcuts (a.k.a. “syntactic sugar”) I use in the uploaded code, I’m attaching a small section of the code in this post with comments to help you understand and perhaps use them in your own programs:

Continue reading ‘Simulating Blackjack’ »

Lab 9: Arrays and Iterators

Objectives

  • Practice the basics of array access and manipulation
  • Use arrays to hold an indeterminate amount of data
  • Explain the semantics of the array collect, select, reject, and inject iterators
  • Use iterators and blocks to examine array contents
  • Use iterators and blocks as an alternative to loops

    Continue reading ‘Lab 9: Arrays and Iterators’ »