CSCI 136 - Spring 2018

Data Structures & Advanced Programming

Home | Lectures 9am 10am | Labs | Handouts | Links | CS@Williams | Piazza

Lab 9: Hex-a-Pawn

This week you may again choose to work with a partner. This is a challenging lab because it can be hard to debug. Discussing your design with a parnter will be helpful! If you would like to work by yourself, we still encourage you to collaborate with a "discussion partner" in lab to finalize your design—you can still independently code and submit your lab after an initial strategy discussion. Debugging your design will help you to write bug-free code!

This week's lab uses trees to play Hex-a-Pawn, a small chess-like game. The lab is outlined in Section 12.11 of your textbook. You will build a tree that starts from the initial game state and represents all possible game board states. You will then implement several different players that consult this tree to make moves as they play Hex-a-Pawn. The players include:
  1) a human player that asks the user for moves to make
  2) a random player that picks possible moves at random
  3) a computer player that improves its strategy by learning from past mistakes.

In the end, you will be able to run the different players against each other.

Pre-lab

Before arriving to your scheduled lab, prepare a design document for the GameTree class. It will not be collected, but it will be worth 2 points of your lab grade. For those who choose to work with a partner, each partner must prepare their own design document; you should collaborate on a final design after the lab has started.

There are three starter files available on the lab page: HexBoard.java (javadoc), HexMove.java (javadoc),, and Player.java (javadoc). Familiarize yourself with these classes. They are described briefly in the book, and the javadoc documentation should be a helpful reference.

Regardless of whether or not you would like to work with a partner, please fill out the following online form by Tuesday at 5pm so that we can make your Lab 8 repositories.

Lab Details

The lab is described in Section 12.11 of your textbook. The description below is meant to supplement the instructions there, so carefully read the lab description in the textbook first.

Thought Questions

Please answers thought questions 1 and 2 from the book (pg 314). When working on the thought problems, your program may run out of memory. You may increase the size of the heap for your program by running it as, for example:

	  $ java -Xmx500m HexaPawn 3 3 comp human
      

The option "-Xmx500m" indicates that your program is allowed to allocate up to 500MiB of memory using the new keyword.

Lab Deliverables

Please complete and submit the following items in your repository:

Submitting Your Lab

As you complete various milestones, you should commit your changes and push them. Commit early and often. When the deadline arrives, we will retrieve the latest version of your code. If you are confident that you are done, please include "Lab Submission" as the commit message for your final commit. If you later decide that you have more edits to make, it is OK. We will look at the latest commit before the deadline.

We will know that the files are yours because they are in your git repository. Do not include identifying information in the code that you submit. Our goal is to grade the programs anonymously to avoid any bias. However, in your README.md file, please cite any sources of inspiration or collaboration (e.g., conversations with classmates). We take the honor code very seriously, and so should you. Please include the statement "I am the sole author of the work in this repository." in the comments at the top your java files.