クラス Player

java.lang.Object
  拡張Player

public class Player
extends Object

ジャンケンを行うプレイヤークラス。


フィールドの概要
private  String name
          プレイヤーの名前
static int PAPER
          パー
static int SCISSORS
          チョキ
static int STONE
          グー
private  Tactics tactics
          与えられた戦略
private  int winCount
          プレイヤーの勝った回数
 
コンストラクタの概要
Player(String name)
          プレイヤークラスのコンストラクタ。
 
メソッドの概要
(パッケージプライベート)  String getName()
          自分の名前を答える。
(パッケージプライベート)  int getWinCount()
          自分の勝った回数を答える
(パッケージプライベート)  void notifyResult(boolean result)
          勝敗を聞く(教える)。
(パッケージプライベート)  void setTactics(Tactics tactics)
          プレイヤーに戦略を渡す。
(パッケージプライベート)  int showHand()
          ジャンケンの手を出す。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

STONE

public static final int STONE
グー

関連項目:
定数フィールド値

SCISSORS

public static final int SCISSORS
チョキ

関連項目:
定数フィールド値

PAPER

public static final int PAPER
パー

関連項目:
定数フィールド値

name

private String name
プレイヤーの名前


winCount

private int winCount
プレイヤーの勝った回数


tactics

private Tactics tactics
与えられた戦略

コンストラクタの詳細

Player

public Player(String name)
プレイヤークラスのコンストラクタ。

パラメータ:
name - 名前
メソッドの詳細

setTactics

void setTactics(Tactics tactics)
プレイヤーに戦略を渡す。

パラメータ:
tactics - 戦略

showHand

int showHand()
ジャンケンの手を出す。

戻り値:
ジャンケンの手

notifyResult

void notifyResult(boolean result)
勝敗を聞く(教える)。

パラメータ:
result - true:勝ち,false:負け

getWinCount

int getWinCount()
自分の勝った回数を答える

戻り値:
勝った回数

getName

String getName()
自分の名前を答える。

戻り値:
名前