Android Open Source - septica-for-android Base A I






From Project

Back to project page septica-for-android.

License

The source code is released under:

MIT License

If you think the Android project septica-for-android 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 fera.costin.alexandru.ai;
/*w  w  w. j a va 2s  .  com*/
import java.io.Serializable;
import java.util.List;

import fera.costin.alexandru.logic.Game;
import fera.costin.alexandru.logic.ICard;

/**
 * 
 * @author Alexandru Fera
 *
 */
public class BaseAI implements Serializable
{
  private static final long serialVersionUID = -8446827282289749116L;

  protected List<ICard> pile;
  protected List<ICard> opHand;
  protected List<ICard> myHand;

  public BaseAI(Game mGame)
  {
    pile = mGame.getPile();
    opHand = mGame.getOpHand();
    myHand = mGame.getMyHand();
  }

  public ICard continuationMove()
  {
    ICard baseCard = pile.get(0);
    boolean havePoint = (baseCard.getValue() == 't' || baseCard.getValue() == '1');

    for (ICard c : opHand)
      if (c.getValue() == baseCard.getValue()
          || (c.getValue() == '7' && havePoint))
        return c;
    return null;
  }

}




Java Source Code List

fera.costin.alexandru.ai.AI.java
fera.costin.alexandru.ai.BaseAI.java
fera.costin.alexandru.ai.EasyAI.java
fera.costin.alexandru.ai.HardAI.java
fera.costin.alexandru.ai.MediumAI.java
fera.costin.alexandru.db.PersistenceAdapter.java
fera.costin.alexandru.logic.CardDeck.java
fera.costin.alexandru.logic.Card.java
fera.costin.alexandru.logic.Game.java
fera.costin.alexandru.logic.ICard.java
fera.costin.alexandru.ui.MainActivity.java
fera.costin.alexandru.ui.PreferencesActivity.java
fera.costin.alexandru.ui.SepticaActivity.java