CPSC 329 Software Development Fall 2026

CPSC 329 Lab 3: Cooperative Programming

This lab provides an opportunity to practice two cooperating programming techniques: pair programming and swarming.

Collaboration and AI

Labs are for learning and practice — you may help and be helped by others when it comes to figuring out what to do, but in the end you need to understand and be able to do the things for yourself.

You may not use AI to figure out what to do or to do the task for you.

Due Date, Deliverables, and Handin

due Fri 9/18 at the start of class — though everything should actually be handed in at the end of lab

Make sure that you have handed in your code, repository, commit history, and debrief form for the pair programming exercise and your work and the debrief form for the swarming exercise as directed in those sections. One handin per group for each part.


Preliminaries

Provided Code

You've been provided with a partial implementation of a Klondike Solitaire game, following the class organization discussed in class. This is similar to the code you worked with in last week's lab.


Pair Programming

The task in this part is to implement TableauColumn's isSequenceValid(List<Card> sequence) method.

Setup

One person should set up the code you'll be working with:

Together:

Work

Pair programming practices:

If you finish early, continue with Stock.draw(), Waste.removeTop(), and Stock.restock(Waste waste), in that order. Read the comments for those methods to find out what they should do. Note that Stock has no sequencing rules like TableauColumn does — it's just a pile you draw from. Also be sure to read restock's contract carefully — drawing from the stock pile after a restock should reproduce the same order the cards were originally drawn in.

Debrief and Handin

When time is called:


Swarming

The task in this part is to design a way to undo a tableau column move.

Setup

Together:

Assume the following existing API:

TableauColumn:
  boolean isEmpty()
  int size()
  Card top()
  boolean canPlace(Card card)
  void place(Card card)
  boolean canPlace(List<Card> sequence)
  void place(List<Card> sequence)
  Card pickUp()
  List<Card> pickUp(int n)
  List<Card> topCards(int n)

GameEngine:
  boolean moveCards(TableauColumn from, TableauColumn to, int n)

Work

Swarming practices:

If your group finishes early, consider one or both of the following scenarios. For each, discuss whether your single tableau-move undo approach extends to it or whether it would need a significant change. Sketch the outline of the idea first, then fill in more details if you still have time.

Debrief and Handin

When time is called: