Package ee.ttu.cs.iti0011.iabb104231.k1.Player

Source Code of ee.ttu.cs.iti0011.iabb104231.k1.Player.HumanPlayer

package ee.ttu.cs.iti0011.iabb104231.k1.Player;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import ee.ttu.cs.iti0011.iabb104231.k1.Board.StateStorage.IntegersMapStateStorage;

public class HumanPlayer extends AbstractPlayer
{

  public HumanPlayer() {
    super();
    setStorage(new IntegersMapStateStorage());
  }
 
  public HumanPlayer(String name)
  {
    super();
    setName(name);
    setStorage(new IntegersMapStateStorage());
  }
 
  public Integer yourNextMove()
  {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String cellString;
   
    getBoard().output(getName() + ", enter the number of cell where you wish to move");
   
    try {
      cellString = br.readLine();
      return Integer.parseInt(cellString);
     
    } catch (IOException ioe) {
      System.out.println("IO error trying to read your name!");
    }
   
    return null;
  }
}
TOP

Related Classes of ee.ttu.cs.iti0011.iabb104231.k1.Player.HumanPlayer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.