Examples of Hexagon


Examples of com.ardor3d.scenegraph.shape.Hexagon

        addMesh(new Cone("Cone", 8, 8, 2, 4));
        addMesh(new Cylinder("Cylinder", 8, 8, 2, 4));
        addMesh(new Disk("Disk", 8, 8, 3));
        addMesh(new Dodecahedron("Dodecahedron", 3));
        addMesh(new Dome("Dome", 8, 8, 3));
        addMesh(new Hexagon("Hexagon", 3));
        addMesh(new Icosahedron("Icosahedron", 3));
        addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3));
        addMesh(new Octahedron("Octahedron", 3));
        addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8));
        addMesh(new Pyramid("Pyramid", 2, 4));
View Full Code Here

Examples of com.ardor3d.scenegraph.shape.Hexagon

        addMesh(new Cone("Cone", 8, 8, 2, 4));
        addMesh(new Cylinder("Cylinder", 8, 8, 2, 4));
        addMesh(new Disk("Disk", 8, 8, 3));
        addMesh(new Dodecahedron("Dodecahedron", 3));
        addMesh(new Dome("Dome", 8, 8, 3));
        addMesh(new Hexagon("Hexagon", 3));
        addMesh(new Icosahedron("Icosahedron", 3));
        addMesh(new MultiFaceBox("MultiFaceBox", new Vector3(), 3, 3, 3));
        addMesh(new Octahedron("Octahedron", 3));
        addMesh(new PQTorus("PQTorus", 5, 4, 1.5, .5, 128, 8));
        addMesh(new Pyramid("Pyramid", 2, 4));
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  }
 
  protected boolean isInLoop(int i, int j) {
    boolean isInLoop = false;
   
    Hexagon tempHex;
    int pointingTo;
    int[] nextPos = new int[2];
    int team = hexagons[i][j].getTeam();
    nextPos[0]=i;
    nextPos[1]=j;
    do{
      hexagons[nextPos[0]][nextPos[1]].calculating=true;
      pointingTo = hexagons[nextPos[0]][nextPos[1]].getPointingTo();
      tempHex = getHexagon(pointingTo,nextPos[0], nextPos[1]);
      if(tempHex==null)// accommodates pointingTo==0 condition and also edge of grid.
      {
      //  System.out.println("yoo"+i+" "+j);
        nextPos[0]=-1;
        nextPos[1]=-1;
        break;
      }
      else if(tempHex.getTeam()!= team)// when team changes
      {
      //  System.out.println("yo"+i+" "+j+" team "+hexagons[i][j].getTeam()+" "+team);
      //  System.out.println("nextPos "+nextPos[0]+" "+nextPos[1]);
      //  nextPos = getHexagonPos(pointingTo,nextPos[0], nextPos[1]);
      //  System.out.println("nextPos2 "+nextPos[0]+" "+nextPos[1]+" team "+tempHex.getTeam()+" "+hexagons[nextPos[0]][nextPos[1]].getTeam());
        nextPos[0]=-1;
        nextPos[1]=-1;
        break;
      }
      nextPos = getHexagonPos(pointingTo,nextPos[0], nextPos[1]);
    }while(!hexagons[nextPos[0]][nextPos[1]].calculating);
   
    if(nextPos[0]==i && nextPos[1]==j)
      isInLoop = true;
   
    nextPos[0]=i;
    nextPos[1]=j;
    do{
      hexagons[nextPos[0]][nextPos[1]].calculating=false;
      pointingTo = hexagons[nextPos[0]][nextPos[1]].getPointingTo();
      tempHex = getHexagon(pointingTo, nextPos[0], nextPos[1]);
      if(tempHex==null)// accommodates pointingTo==0 condition and also edge of grid.
        break;
      else if(tempHex.getTeam()!= hexagons[i][j].getTeam())// when team changes
        break;
      nextPos = getHexagonPos(pointingTo,nextPos[0], nextPos[1]);
    }while(hexagons[nextPos[0]][nextPos[1]].calculating);
   
    return isInLoop;
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  }
 
  protected boolean isPointingAtMe(int side, int i, int j){
    if(side ==0 )
      return false;
    Hexagon tempHex=null;
    try{
    tempHex = getHexagon(side, i, j);
    }catch(Exception e){
      tempHex=null;
      return false;
    }
    if(tempHex==null)
      return false;
   
    int pointingTo = tempHex.getPointingTo();
    if(side == getHexOppositeSide(pointingTo))
      return true;
//    if((pointingTo==1 && side==4) || (pointingTo==4 && side==1))
//      return true;
//    else if((pointingTo==2 && side ==5) || (pointingTo==5 && side ==2))
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  }
 
  protected boolean isUnderAttack(int i, int j){
   
    int team = hexagons[i][j].getTeam();
    Hexagon tempHex;
    for(int k =1; k<7; k++)
    {
      if(isPointingAtMe(k,i,j) )// calls overloaded method
      {
        tempHex = getHexagon(k, i, j);
        if(tempHex.getTeam()!=team)
          return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

    return false;
  }
 
  protected Hexagon getHexagon(int side, int i, int j)
  {//i,j is actually hexagon[i][j]
    Hexagon tempHex = null;
    int [] tempPos = getHexagonPos(side,i,j);
    if(tempPos==null)
      tempHex = null;
    else
      try{
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

     
    //power of all heads has been calculated..
    // now re-calculate power of those hex which are under attack
    // hexagons can be attacked by heads only
    int pointingTo;
    Hexagon tempHex;
    int [] tempPos;
    for(int i=0; i<headPositions.size(); i++)
    {
      temp = headPositions.elementAt(i);
      pointingTo = hexagons[temp[0]][temp[1]].getPointingTo();
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  }

  private void reCalculatePower(int i, int j) {
    // re-calculates power of hex which is under attack
    //System.out.println("recalculationg for "+i+" "+j);
    Hexagon tempHex;
    int team = hexagons[i][j].getTeam();
   
    Vector <PowerCalculator> powerVector = new Vector<PowerCalculator>();
    PowerCalculator tempPowCal;
    int teamPos;
    for(int k=0; k<7; k++)
    {
      if(isPointingAtMe(k, i, j))
      {
        tempHex = getHexagon(k, i, j);
        if(tempHex.getTeam() != team)
        {
          teamPos=-1;
          for(int l =0; l<powerVector.size(); l++)
          {
            if(powerVector.elementAt(l).getTeam()==tempHex.getTeam())
              teamPos = l;
          }
         
          if(teamPos==-1)
          {
            tempPowCal = new PowerCalculator(tempHex.getTeam());
            powerVector.add(tempPowCal);
          }
          else
          {
            tempPowCal = powerVector.elementAt(teamPos);
          }
         
          tempPowCal.addHex(tempHex.getCurrentPow());
         
        }
      }
    }
   
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  private boolean isPathHead(int i, int j){
   
    boolean isHead = false;
    int pointingTo = hexagons[i][j].getPointingTo();
    Hexagon tempHex = getHexagon(pointingTo,i,j);
   
    if(tempHex==null && pointingTo!=0)// for edges of grid
      return true;
    //|| tempHex.getTeam()!= hexagons[i][j].getTeam()
   
    if(pointingTo==0)// for no team hex pointingTo is always zero but not vice versa
    {
      if(hexagons[i][j].getTeam()!=0)// for single existing team hexagon pointing nowhere
        isHead = true;
      else
        isHead = isPointingAtMe(i,j);// for hexagon with no team and is under attack
    }
    else if(pointingTo!=0)
    {
      if(tempHex.getTeam()!= hexagons[i][j].getTeam())// for opposite team and may be also for no-team hexagon
      {
        isHead = true;
      }
      else// runs if team is same // its for circular loop head
      {
View Full Code Here

Examples of com.gardeneaters.game_v0.playingfield.Hexagon

  }
 
  private boolean isCircularLoopHead(int i, int j){
    boolean isInLoop = false;
   
    Hexagon tempHex;
    int pointingTo;
    int[] nextPos = new int[2];
    int team = hexagons[i][j].getTeam();
    nextPos[0]=i;
    nextPos[1]=j;
    do{
      hexagons[nextPos[0]][nextPos[1]].calculating=true;
      pointingTo = hexagons[nextPos[0]][nextPos[1]].getPointingTo();
      tempHex = getHexagon(pointingTo,nextPos[0], nextPos[1]);
      if(tempHex==null)// accommodates pointingTo==0 condition and also edge of grid.
      {
        nextPos[0]=-1;
        nextPos[1]=-1;
        break;
      }
      else if(tempHex.getTeam()!= team)// when team changes
      {
        nextPos[0]=-1;
        nextPos[1]=-1;
        break;
      }
      nextPos = getHexagonPos(pointingTo,nextPos[0], nextPos[1]);
    }while(!hexagons[nextPos[0]][nextPos[1]].calculating);
   
    if(nextPos[0]==i && nextPos[1]==j)
      isInLoop = true;

    int [] temp;
    nextPos[0]=i;
    nextPos[1]=j;
    do{
      hexagons[nextPos[0]][nextPos[1]].calculating=false;
      if(isInLoop)// when another element of loop already exists in headPositions vector
      {
       
        for(int k=0; k<headPositions.size(); k++)
        {
          temp = headPositions.elementAt(k);
          if(nextPos[0]==temp[0] && nextPos[1]==temp[1])
          {
            isInLoop=false;
            //System.out.println("isINLoopHead said False");
            break;
          }
        }
      }
     
      pointingTo = hexagons[nextPos[0]][nextPos[1]].getPointingTo();
      tempHex = getHexagon(pointingTo, nextPos[0], nextPos[1]);
      if(tempHex==null)// accommodates pointingTo==0 condition and also edge of grid.
        break;
      else if(tempHex.getTeam()!= team)// when team changes
        break;
      nextPos = getHexagonPos(pointingTo,nextPos[0], nextPos[1]);
    }while(hexagons[nextPos[0]][nextPos[1]].calculating);
   
    return isInLoop;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.