Package com.daven.java4.slimemold

Examples of com.daven.java4.slimemold.Patch


    //radiate pheromones
    //Eclipse thinks pheromones is spelled wrong. More biologists should build IDEs. Or tech dictionaries.
    Set<Point> patchKeys = patchMatrix.keySet();
    for ( Point k : patchKeys )
    {
      Patch centerPatch = patchMatrix.get( k );
      if ( centerPatch.getStinkLevel() > 1 )
      {
        List<Point> adjoiningLocations = mapper.getAllAdjoining( centerPatch.getPosition() );
        for ( Point adjoiningLocation : adjoiningLocations )
        {
          patchMatrix.get( adjoiningLocation ).setStinkLevelWithoutExceeding( centerPatch.getStinkLevel() - 1 );
        }
      }
    }
   
    clearTheBoard();
   
    //draw patches that stink
    for ( Point k : patchKeys )
    {
      Patch p = patchMatrix.get( k );
      if ( p.getStinkLevel() > 0 )
        p.paint();
    }
    //draw cells
    for ( SimulationObject so : population )
    {
      so.paint();
View Full Code Here


    return isOccupied( nextPatch( p, orientation, distance ));
  }
 
  public void releaseStink( Point location, int stinkLevel )
  {
    Patch p = patchMatrix.get( location );
    p.setStinkLevel( stinkLevel );
  }
View Full Code Here

    for ( int x = 0; x < patchesX; x++ )
    {
      for ( int y = 0; y < patchesY; y++ )
      {
        Point location = new Point( x * patchPixelSize, y * patchPixelSize );
        patchMatrix.put( location, new Patch( location, graphics, displayArea.getBackground(), patchPixelSize ) );
      }
    }
   
    population.clear();
    Point proposedPosition;
View Full Code Here

        int y = rand.nextInt( patchesY ) * patchPixelSize;
        proposedPosition = new Point( x, y );
      } while ( isOccupied( proposedPosition ) );
      int compassOrdinal = rand.nextInt( 8 );
      EightPointCompass orientation = EightPointCompass.fromOrdinal( compassOrdinal );
      population.add( new SlimeMoldCell( this, proposedPosition, orientation, graphics, patchPixelSize, rand ) );
    }
    modelChanged();
  }
View Full Code Here

TOP

Related Classes of com.daven.java4.slimemold.Patch

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.