Package net.sourceforge.java_stratego.stratego

Examples of net.sourceforge.java_stratego.stratego.Piece


      case GRID:
        x = in.readInt();
        y = in.readInt();
        color = in.readInt();
        rank = in.readInt();
        view.update(new Spot(x, y), new Piece(0, color, Rank.values()[rank]));
        return true;
      case TRAY:
        x = in.readInt();
        color = in.readInt();
        rank = in.readInt();
        view.update(Board.IN_TRAY, new Piece(x, color, Rank.values()[rank]));
        return true;
      case GAMEOVER:
        x = in.readInt();
        view.gameOver(x);
        return true;
View Full Code Here


   
    //double check the ai setup
    for (int i=0;i<10;i++)
    for (int j=0;j<4; j++)
    {
      Piece p = null;
      for (int k=0;k<board.getTraySize();k++)
        if (board.getTrayPiece(k).getColor() == Settings.topColor)
        {
          p = board.getTrayPiece(k);
          break;
        }

      if (p==null)
        break;
       
      engine.aiReturnPlace(p, new Spot(i, j));
    }
   
    //if the user didn't finish placing pieces just put them on
    for (int i=0;i<10;i++)
    for (int j=6;j<10;j++)
    {
      Piece p = null;
      for (int k=0;k<board.getTraySize();k++)
        if (board.getTrayPiece(k).getColor() != Settings.topColor)
        {
          p = board.getTrayPiece(k);
          break;
View Full Code Here

        if (b.validMove(f, t))
        {
          hasMove = true;
         
          Move tmpM = new Move(b.getPiece(f), f, t);
          Piece fp = b.getPiece(f);
          Piece tp = b.getPiece(t);
          b.move(tmpM);
          //int tmpV = valueBoard(b) + (int)(valueNMoves(b, n-1) * ALPHA);
          int tmpV = valueBoard(b);
          if (tp == null ||
            (fp.isKnown() && turn == Settings.bottomColor) ||
            (tp.isKnown() && turn == Settings.topColor))
            tmpV += valueNMoves(b, n-1, guesses);
          else if (guesses <= MAX_GUESSES)
            tmpV += (int) (ALPHA * valueNMoves(b, n-1, guesses+1));
           
          b.undo(fp, f, tp, t);
View Full Code Here

        switch (Message.values()[type])
        {
        case MOVE:
          int x1, x2, y1, y2, rank;
          Spot from, to;
          Piece p;
          x1 = in.readInt();
          y1 = in.readInt();
          x2 = in.readInt();
          y2 = in.readInt();
          rank = in.readInt();
          if (x1 < 0)
          {
            from = Board.IN_TRAY;
            p = new Piece(0, 0, Rank.values()[rank]);
          }
          else
          {
            from = new Spot(x1, y1);
            p = engine.getBoardPiece(x1, y1);
View Full Code Here

TOP

Related Classes of net.sourceforge.java_stratego.stratego.Piece

Copyright © 2018 www.massapicom. 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.