Archive for November 2008

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 . 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’ »