Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

antichess
Class TextUI2  view TextUI2 download TextUI2.java

java.lang.Object
  extended byantichess.TextUI2
All Implemented Interfaces:
java.util.Observer

public class TextUI2
extends java.lang.Object
implements java.util.Observer

Interactive loop for textui


Field Summary
(package private)  java.lang.String boardString
           
(package private)  java.lang.String[] colorStr
           
(package private)  java.lang.String filename
           
(package private)  GameController gc
           
(package private)  HumanPlayer humanPlayer
           
private  java.lang.Thread onGoingGame
           
 
Constructor Summary
TextUI2()
           
 
Method Summary
private  void breakGame(GameMessage gm)
          Ends a game
 void displayBoard()
          Displays the current board
private  void displayGame()
          Displays the time left and board
private  void displayTime()
          Display timeleft
private  void getHumanMove()
          Gets a user input move from standard input
 void getValues()
          Asks user to read from file or get other information about the game
static void main(java.lang.String[] args)
           
private  void moveMade()
          Given a move made, this method displays the new board, and will check if the human player can make a move in the next turn.
 void printBoard()
           
 void printMoves()
           
 java.lang.String repeat(java.lang.String s, int times)
          Given s, returns a string with s repeated a number of times
private  void runGame()
          Starts and runs the game
 void saveGame()
           
 void startUp()
           
 void update(java.util.Observable o, java.lang.Object arg)
          This method is called whenever the gamecontroller object has an update in the flow of the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gc

GameController gc

filename

java.lang.String filename

colorStr

java.lang.String[] colorStr

boardString

java.lang.String boardString

humanPlayer

HumanPlayer humanPlayer

onGoingGame

private java.lang.Thread onGoingGame
Constructor Detail

TextUI2

public TextUI2()
Method Detail

startUp

public void startUp()

getValues

public void getValues()
Asks user to read from file or get other information about the game


repeat

public java.lang.String repeat(java.lang.String s,
                               int times)
Given s, returns a string with s repeated a number of times


displayBoard

public void displayBoard()
Displays the current board


displayTime

private void displayTime()
Display timeleft


displayGame

private void displayGame()
Displays the time left and board


runGame

private void runGame()
Starts and runs the game


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
This method is called whenever the gamecontroller object has an update in the flow of the game. This is a required method by java.util.Observer interface.

Specified by:
update in interface java.util.Observer

breakGame

private void breakGame(GameMessage gm)
Ends a game


moveMade

private void moveMade()
Given a move made, this method displays the new board, and will check if the human player can make a move in the next turn. If the human player can make a move, it will call getHumanMove


getHumanMove

private void getHumanMove()
Gets a user input move from standard input


saveGame

public void saveGame()

printMoves

public void printMoves()

printBoard

public void printBoard()

main

public static void main(java.lang.String[] args)