Assignment 3 Help

You can use this template for the homework. Each player is initially on the first square. When her turn comes, the current player draws a color from the colors array. The player then uses the board to advance her token (as explained in the text of the assignment). Whoever reaches the last square of the board array wins and the game ends.

If you want to do the problem in a different way that's also fine, just make sure that you comment your code nicely.

import BreezyGUI.*;
import java.awt.*; 

public class CandyLand extends GBFrame {

  Button   bMove      = addButton   (     "Go", 1, 1, 1, 1); 
  Button   bStartGame = addButton   ("reStart", 1, 2, 1, 1); 
  TextArea tArea      = addTextArea (       "", 2, 1, 2, 10); 

  String[] board = { 
     "red",    "green", "red",    "gumdrop", "yellow", "candycane", 
     "yellow", "blue",  "yellow", "green",   "purple", "blue" }; 

  Player[] players; 
  String[] colors = {
     "red",  "green", "gumdrop", "yellow", "candycane",  "blue", "purple"

  // any other data fields you may need 

  boolean gameStarted = false, gameOver = false; 

  public void buttonClicked (Button buttonObj) {
    if (buttonObj == bStartGame) 

  void startGame() {
    // initialize your data structures for a new game 

  void moveOnce() {
    if (! gameStarted) messageBox("Please start the game first.");
    else if (gameOver) messageBox("The game is over, please restart it."); 
         else {
           // move the current player. Check to see if game not over
           // after this move. If not update currentPlayer (next in line)y.

  void showBoard() {
    // show the board in tArea 
    // clear first, then output it

  public static void main(String[] args) {
    // standard main method for a BreezyGUI application 

class Player {
 // template for a Player object