Android Open Source - android-tic-tac-toe Action State






From Project

Back to project page android-tic-tac-toe.

License

The source code is released under:

MIT License

If you think the Android project android-tic-tac-toe listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.shaon.android.tictactoe.model;
/*from w  ww. j av  a  2s.  c  o m*/
/**
 * Represents a pair of action and state. Successor list of a state is a 
 * a list of <code>ActionState</code>. An object of this class means 
 * the corresponding state is achieved with this action.    
 * 
 * @author fahad
 */
public class ActionState {

  private State state;
  private Action action;

  public ActionState(State state, Action action) {
    this.state = state;
    this.action = action;
  }

  public State getState() {
    return state;
  }

  public void setState(State state) {
    this.state = state;
  }

  public Action getAction() {
    return action;
  }

  public void setAction(Action action) {
    this.action = action;
  }

  @Override
  public String toString() {
    
    StringBuilder stringBuilder = new StringBuilder();
    
    stringBuilder.append("Action: [");
    stringBuilder.append(action.getPlayer());
    stringBuilder.append(" at ");
    stringBuilder.append("Row - ");
    stringBuilder.append(action.getRow());
    stringBuilder.append(", Column - ");
    stringBuilder.append(action.getColumn());
    stringBuilder.append("]");
    stringBuilder.append("\n");
    stringBuilder.append(state.toString());
    
    return stringBuilder.toString();
  }
}




Java Source Code List

org.shaon.android.tictactoe.TicTacToeApplication.java
org.shaon.android.tictactoe.activity.SettingsActivity.java
org.shaon.android.tictactoe.activity.TicTacToeActivity.java
org.shaon.android.tictactoe.board.Board.java
org.shaon.android.tictactoe.board.Cell.java
org.shaon.android.tictactoe.exception.InvalidTurn.java
org.shaon.android.tictactoe.model.ActionState.java
org.shaon.android.tictactoe.model.Action.java
org.shaon.android.tictactoe.model.AlphaBetaSearch.java
org.shaon.android.tictactoe.model.MinMax.java
org.shaon.android.tictactoe.model.PlayerConfig.java
org.shaon.android.tictactoe.model.SearchAlgorithm.java
org.shaon.android.tictactoe.model.State.java
org.shaon.android.tictactoe.model.TerminatingCondition.java
org.shaon.android.tictactoe.model.WinningCombination.java