Package com.oti

Examples of com.oti.Piece


    //    System.out.println("SAM TO REMOVE createMove firstCel "+ firstCell+" otherCell "+ otherCell);
    //    System.out.println("SAM TO REMOVE createMove firstCellVal "+ firstCellVal+" otherCellVal "+ otherCellVal);
   
   
    Piece currPiece = null;
    Location  currLoc = null;
    if (firstCellVal==0) {
      currPiece = Piece.pieceForNumber(otherCellVal);
      currLoc = Location.locationFor(firstCell%4, firstCell/4, 4);
    } else {
View Full Code Here


  private BigInteger createState(Board board) {
    BigInteger res = BigInteger.valueOf(0);
    for (int i = 0; i < 4; i++) {
      int fourth = 0;
      for (int j = 0; j < 4; j++) {       
        Piece cell = board.pieceAt(j, i);
        fourth = fourth << 4;
        fourth |= cell.getPieceNumber();
      }
      res= res.shiftLeft(16);
      res = res.add(BigInteger.valueOf(fourth));
    }
   
View Full Code Here

    //    System.out.println("SAM TO REMOVE createMove firstCel "+ firstCell+" otherCell "+ otherCell);
    //    System.out.println("SAM TO REMOVE createMove firstCellVal "+ firstCellVal+" otherCellVal "+ otherCellVal);
   
   
    Piece currPiece = null;
    Location  currLoc = null;
    if (firstCellVal==0) {
      currPiece = Piece.pieceForNumber(otherCellVal);
      currLoc = Location.locationFor(firstCell%4, firstCell/4, 4);
    } else {
View Full Code Here

   * */
  private StateCode createState(Board board) {
    StateCode res = new StateCode();
    byte[] arr = res.toByteArray();
    for (int i = 0; i < 16; i++) {
      Piece cell = board.pieceAt(i%4, i/4);
      if (i%2==1)
        arr[i/2] = (byte) (arr[i/2] << 4);
     
      arr[i/2] |= (byte) (0x0F & cell.getPieceNumber());

    }
    System.out.println("SAM TO REMOVE createState() ");
    SASolverNoBigInt.printState(res);   
   
View Full Code Here

public class TestPiece {

    @Test
    public void testPiece(){
        Piece blank = Piece.pieceForNumber(0);
        Piece one = Piece.pieceForNumber(1);
        Piece otherOne = Piece.pieceForNumber(1);
        Piece two = Piece.pieceForNumber(2);

        Assert.assertThat(one, is(one));
        Assert.assertThat(one, is(otherOne));
        Assert.assertThat(blank, is(blank));
        Assert.assertThat(blank, is(not(one)));

        Assert.assertTrue(one.compareTo(two) < 0);
        Assert.assertTrue(two.compareTo(one) > 0);
        Assert.assertTrue(one.compareTo(one) == 0);
        Assert.assertTrue(two.compareTo(two) == 0);

        // blank always comes at the end
        Assert.assertTrue(blank.compareTo(one) > 0);
        Assert.assertTrue(one.compareTo(blank) < 0);
        Assert.assertTrue(one.compareTo(one) == 0);
View Full Code Here


public class TestMove {
    @Test
    public void testMove(){
        Piece blank = Piece.pieceForNumber(0);
        Piece one = Piece.pieceForNumber(1);
        Piece otherOne = Piece.pieceForNumber(1);
        Piece two = Piece.pieceForNumber(2);

        Location locOfBlank = Location.locationFor(3,3, 4);
        Location otherLocOfBlank = Location.locationFor(3, 3, 4);
        Location locOfOne = Location.locationFor(0,0, 4);
        Location locOfTwo = Location.locationFor(1,0, 4);
View Full Code Here

TOP

Related Classes of com.oti.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.