MagicModel - import java.util.*; i import java.awt.*; p...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; i public class MagicModel { p private String board[][]; private int values[][]; private int status; private int currentValue = 1; private ArrayList<MagicObservers> observers; public static final int SIZE = 3; private static final int WON = 1; private static final int LOST = 2; private static final int INGAME = 3; public MagicModel() { this.observers = new ArrayList<MagicObservers>(); this.board = new String[this.SIZE][this.SIZE]; this.values = new int[this.SIZE][this.SIZE]; for(int x = 0; x<SIZE; x++) { for(int y = 0; y<SIZE; y++) { this.values[x][y] = 0; this.board[x][y] = " "; } } this.status = MagicModel.INGAME; } public int getStatus() { return this.status; } public void addObservers(MagicObservers ml) { this.observers.add(ml); } public int getCurrentValue() { return this.currentValue; } public boolean isEmpty(int x, int y) { if(this.board[x][y].equals(" ")) { return true; } return false; } public String getStringValue(int x, int y) { return this.board[x][y];
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/13/2010 for the course SYSC 2101 taught by Professor Babac during the Winter '10 term at Carleton CA.

Page1 / 3

MagicModel - import java.util.*; i import java.awt.*; p...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online