Game - /* * To change this template, choose Tools |...

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

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package minesweeper; import java.awt.Color; import javax.swing.*; /** * * @author lloydwilkerson */ public class Game { // player (name) private String player; // "playing" indicates whether a game is running (true) or not (false). private boolean playing; // The minefield private Minefield minefield; // timer settings private Thread timer; private int timeLeft; // Scores private String[][] lastScores; private int score; /** * Game constructor * Initializes the application; not an actual new game. * * @param player */ public Game(String player) { // Set player name. setPlayer(player); // Make sure a player has to press "new game" to start a new game. setPlaying(false); // Create a new minefield. // Set scores. setLastScores(new String[4][2]); setScore(0); // Reset the scores. resetScores(); }
Background image of page 1

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

View Full DocumentRight Arrow Icon
/** * Game constructor for an anonymous player (startup of the app). */ public Game() { this(""); } /** * Sets the player name to player. * * @param player * @post Sets this.player to player. | new.getPlayer() == player */ public void setPlayer(String player) { this.player = player; } /** * Getter for the player attribute. * * @return The String player. */ public String getPlayer() { return player; } /** * Sets this.playing to true or false. * * @param playing * @post Sets this.playing to playing. | new.getPlaying() == playing */ public void setPlaying(boolean playing) { this.playing = playing; } /** * Getter for the playing attribute. * * @return true if this.playing is true; else false */ public boolean isPlaying() { return playing; } /** * Sets the minefield. * * @param Minefield minefield
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Page1 / 7

Game - /* * To change this template, choose Tools |...

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

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