CS1                                                                                   
2D Arrays

 (Othello ('Reversi') (XNA) ; Othello ('Reversi')  (Console) )

 
Key Topics That Students Will Learn In This Assignment:
  1. Two-Dimensional (2D) Arrays (primarily traversing, nothing about allocation, and only optionally about passing to/from methods)
  2. Basic object usage
  3. Algorithm Creation And Implementation
    1. Optional: Functional Decomposition
Pre-requisite Knowledge That Students Must Know, Prior To Starting This Assignment:

(What students must know in order to able to complete this assignment)

  • Flow Control: conditional selection (if statements)
  • Flow Control: iteration (loops)
  • Simple/Primitive Variables: int, double (etc)
  • Encapsulation
  • Arrays: Using a 2-dimensional array
  • OOP: Basic object usage, without having to define new classes or methods.
  • ( The Console version does NOT require Basic Console Input/Output, as all the user I/O has been provided to the students)
Summary Game Description: Othello (also known as 'Reversi') is a simple-yet-engaging game for 2 players; the objective is to have the largest number of playing pieces under one's control when the game ends.  The game is played on a square board composed of a grid of spaces (visually, the board resembles graph paper - normally the grid is 8x8).  The game starts with 2 of each player's pieces on the board.  Each of the players alternates playing, with each player placing a piece on the board during their turn.  Each piece must be placed according to two rules: (1) the newly placed piece is adjacent to one of the other player's pieces that's already on the board, and (2) the newly placed piece must be able to trace a straight-line path (vertically, horizontally, or diagonally) over the other player's pieces to a piece that belongs to the current player, which 'brackets' the opponent's pieces.  Doing so flips (or 'reverses') all the opposing player's pieces between the two pieces.  The game is described in more detail at http://en.wikipedia.org/wiki/Reversi  

Assignment Description: This assignment is remarkably similar between the Console and XNA versions.  In both cases, the students are provided with all the user-interface code (that renders the board on the screen, informs the players whose turn it is, and accepts input from the current player), and they are required to implement the logic that determines if a move is valid (if it's adjacent to a piece of the opposite color, and if a line can be traced from the newly placed piece, across 1+ pieces of the opposite color, to a piece of the same color).  The students must also implement a routine that tells the user interface code if there are no more valid moves left to be made for the current player (in which case, the game is over)

  Instructor F.A.Q.
Pre-Test Post-Test
Lecture Hours Prior To Assignment Due Date: 5
ACM Classification (Topics Covered):

(What the students will learn, and demonstrate, by doing this assignment)

 

From:
 

Computing Curricula 2001

Computer Science

Final Report
(December 15, 2001)


written by
 

The Joint Task Force on Computing Curricula
IEEE Computer Society
Association for Computing Machinery

 

PF1. Fundamental programming constructs

  • Basic syntax and semantics of a higher-level language

  • Variables, types, expressions, and assignment

  • Simple I/O

  • Conditional and iterative control structures

  • Structured decomposition (optional)

 

PF2. Algorithms and problem-solving

  • Problem-solving strategies

  • The role of algorithms in the problem-solving process

PF3. Fundamental data structures

  • Primitive types

  • Arrays - specifically two-dimensional arrays

  • Strings and string processing

  • Pointers and references

  

AL2. Algorithmic strategies

  • Brute-force algorithms

 PL6. Object-oriented programming
(This coverage is limited, and mostly amounts to showing-by-example)

  • Separation of behavior and implementation

  • Classes and subclasses

 
Technical Requirements:

(What the students will learn, and demonstrate, by doing this assignment)

 

From:
 

Computing Curricula 2001

Computer Science

Final Report
(December 15, 2001)


written by
 

The Joint Task Force on Computing Curricula
IEEE Computer Society
Association for Computing Machinery

 

It is hoped that providing this information may help instructors with the accreditation process, as calling this information out will help clarify how this assignment (and from here, the overall course) meets the learning outcomes for the overall program/department, and institution.

PF1. Fundamental programming constructs

PF1.1 - Analyze and explain the behavior of simple programs involving the fundamental programming constructs covered by this unit.

(The students are given code, and required to demonstrate that they understand the program by modifying the program)

 

PF1.2 - Modify and expand short programs that use standard conditional and iterative control structures and functions.

(The primary goal of the assignment is to modify the code that's provided by the instructor)

 

PF1.3 - Design, implement, test, and debug a program that uses each of the following fundamental programming constructs: basic computation, simple I/O, standard conditional and iterative structures, and the definition of functions.

(The primary goal of the assignment is to modify the code that's provided by the instructor, which requires the use of the fundamental programming constructs listed above.)

 

PF1.4 - Choose appropriate conditional and iteration constructs for a given programming task.

(The primary goal of the assignment is to modify the code that's provided by the instructor, which requires the appropriate use of the conditional an iteration constructs.)

 

PF1.5 - Apply the techniques of structured (functional) decomposition to break a program into smaller pieces. OPTIONAL

 (If the instructor chooses to emphasize this, then the problem will make an ideal candidate for functional decomposition.)

 

PF2. Algorithms and problem-solving

PF2.3 - Create algorithms for solving simple problems.

(The students are given a set of rules for a game, and told that they must create an algorithm that implements the rules.)

PF2.4 - Use pseudocode or a programming language to implement, test, and debug algorithms for solving simple problems.

(The primary goal of the assignment is to not just create an algorithm, but to implement it, as well.)

PL6. Object-oriented programming
PL6.2 - Design, implement, test, and debug simple programs in an object-oriented programming language.

(The primary goal of the assignment is to not just create an algorithm, but to implement it in C#, as well.  NOTE that the students don't create any classes, nor are they required to instantiate any objects, but instead, to merely use the existing objects)

 


 This document and the related materials are developed with support from Microsoft Research Computer Gaming Initiative under the Computer Gaming Curriculum in Computer Science RFP, Award Number 15871.