case Deal:
if (state.getPlayerTurn() == 0) {
if (state.getPlayers().get(0).getChoose() == Choose.PairsPlus) {
gameResult1 = stateChanger.makeMove(state,
state.getPlayerTurn(),
new PlayerMove(Decision.Deal));
state.getPlayers().get(0).setResult(gameResult1.getResult());
state.setPlayerBalance(0, gameResult1.getBalance());
state.setNextPlayerTurn();
graphics.showGameInfo(state.getPlayerTurn());
//setState(this.state);
//History.newItem(serializeState(state));
if(!AI)
pokerService.AMove(serializeState(this.state), currentMatchId,userId, otherId, updateCallback);
if (state.getPlayers().get(1).getChoose() == Choose.Ante){
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
else{
graphics.setDealBtn(true);
graphics.setPlayBtn(false);
graphics.setFoldBtn(false);
}
//if player play with computer
if(AI){
if (state.getPlayers().get(1).getChoose() == Choose.PairsPlus) {
gameResult2 = stateChanger.makeMove(state,
state.getPlayerTurn(),
new PlayerMove(Decision.Deal));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if (state.getPlayers().get(1).getChoose() == Choose.Ante){
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Play");
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Fold");
graphics.setRestartBtn(true);
}
}
else{
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Deal));
state.setPlayerBalance(1, gameResult2.getBalance());
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
}
}
}
else {
gameResult1 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Deal));
state.setPlayerBalance(0, gameResult1.getBalance());
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
} else {
if (state.getPlayers().get(1).getChoose() == Choose.PairsPlus) {
gameResult2 = stateChanger.makeMove(state,
state.getPlayerTurn(),
new PlayerMove(Decision.Deal));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
//setState(this.state);
//History.newItem(serializeState(state));
pokerService.EndMove(serializeState(this.state), currentMatchId,userId, otherId, meID,updateCallback);
graphics.setRestartBtn(true);
} else {
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Deal));
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
}
break;
case Play:
if (state.getPlayerTurn() == 0) {
if (state.getPlayers().get(0).getChoose() == Choose.Ante) {
gameResult1 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(0).setResult(gameResult1.getResult());
state.setPlayerBalance(0, gameResult1.getBalance());
state.setNextPlayerTurn();
graphics.showGameInfo(state.getPlayerTurn());
//setState(this.state);
//History.newItem(serializeState(state));
if(!AI)
pokerService.AMove(serializeState(this.state), currentMatchId,userId, otherId, updateCallback);
if (state.getPlayers().get(1).getChoose() == Choose.Ante){
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
else{
graphics.setDealBtn(true);
graphics.setPlayBtn(false);
graphics.setFoldBtn(false);
}
} else {
gameResult1 = stateChanger.makeMove(state, state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(0).setResult(gameResult1.getResult());
state.setPlayerBalance(0, gameResult1.getBalance());
state.setNextPlayerTurn();
graphics.showGameTurn(state.getPlayerTurn(),AI);
if(!AI)
pokerService.AMove(serializeState(this.state), currentMatchId,userId, otherId, updateCallback);
if (state.getPlayers().get(1).getChoose() == Choose.Ante){
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
else{
graphics.setDealBtn(true);
graphics.setPlayBtn(false);
graphics.setFoldBtn(false);
}
}
//if player play with computer
if(AI){
if (state.getPlayers().get(1).getChoose() == Choose.PairsPlus) {
gameResult2 = stateChanger.makeMove(state,
state.getPlayerTurn(),
new PlayerMove(Decision.Deal));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if (state.getPlayers().get(1).getChoose() == Choose.Ante){
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Play");
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Fold");
graphics.setRestartBtn(true);
}
}
else{
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Deal));
state.setPlayerBalance(1, gameResult2.getBalance());
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
}
}
} else {
if (state.getPlayers().get(1).getChoose() == Choose.Ante) {
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
//setState(this.state);
//History.newItem(serializeState(state));
pokerService.EndMove(serializeState(this.state), currentMatchId,userId, otherId, meID,updateCallback);
graphics.setRestartBtn(true);
} else {
gameResult2 = stateChanger.makeMove(state, state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
//setState(this.state);
//History.newItem(serializeState(state));
pokerService.EndMove(serializeState(this.state), currentMatchId,userId, otherId, meID,updateCallback);
graphics.setRestartBtn(true);
}
}
break;
case Fold:
if (state.getPlayerTurn() == 0) {
if (state.getPlayers().get(0).getChoose() == Choose.Ante) {
gameResult1 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(0).setResult(gameResult1.getResult());
state.setPlayerBalance(0, gameResult1.getBalance());
state.setNextPlayerTurn();
graphics.showGameTurn(state.getPlayerTurn(),AI);
//setState(this.state);
//History.newItem(serializeState(state));
if(!AI)
pokerService.AMove(serializeState(this.state), currentMatchId,userId, otherId, updateCallback);
if (state.getPlayers().get(1).getChoose() == Choose.Ante){
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
else{
graphics.setDealBtn(true);
graphics.setPlayBtn(false);
graphics.setFoldBtn(false);
}
} else {
gameResult1 = stateChanger.makeMove(state, state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(0).setResult(gameResult1.getResult());
state.setPlayerBalance(0, gameResult1.getBalance());
state.setNextPlayerTurn();
graphics.showGameTurn(state.getPlayerTurn(),AI);
if(!AI)
pokerService.AMove(serializeState(this.state), currentMatchId,userId, otherId, updateCallback);
if (state.getPlayers().get(1).getChoose() == Choose.Ante){
graphics.setPlayBtn(true);
graphics.setFoldBtn(true);
graphics.setDealBtn(false);
}
else{
graphics.setDealBtn(true);
graphics.setPlayBtn(false);
graphics.setFoldBtn(false);
}
}
//if player play with computer
if(AI){
if (state.getPlayers().get(1).getChoose() == Choose.PairsPlus) {
gameResult2 = stateChanger.makeMove(state,
state.getPlayerTurn(),
new PlayerMove(Decision.Deal));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if (state.getPlayers().get(1).getChoose() == Choose.Ante){
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Play");
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.showComputerDecision("Computer decide: Fold");
graphics.setRestartBtn(true);
}
}
else{
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Deal));
state.setPlayerBalance(1, gameResult2.getBalance());
String decison=myPokerAI.getDecision(state);
if(decison=="Play"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Play));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
else if(decison=="Flod"){
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
setState(state);
graphics.setRestartBtn(true);
}
}
}
} else {
if (state.getPlayers().get(1).getChoose() == Choose.Ante) {
gameResult2 = stateChanger.makeMove(state,state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
//setState(this.state);
//History.newItem(serializeState(state));
pokerService.EndMove(serializeState(this.state), currentMatchId,userId, otherId, meID,updateCallback);
graphics.setRestartBtn(true);
} else {
gameResult2 = stateChanger.makeMove(state, state.getPlayerTurn(),new PlayerMove(Decision.Fold));
state.getPlayers().get(1).setResult(gameResult2.getResult());
state.setPlayerBalance(1, gameResult2.getBalance());
graphics.playDecisionSound();
//setState(this.state);
//History.newItem(serializeState(state));