Package transientlibs.rlforj.examples

Source Code of transientlibs.rlforj.examples.FovExample

package transientlibs.rlforj.examples;

import java.util.Random;


import transientlibs.rlforj.los.PrecisePermissive;
import transientlibs.rlforj.los.ShadowCasting;
import transientlibs.rlforj.los.IFovAlgorithm;

public class FovExample
{

  /**
   * Each time creates a 21x21 area with random obstacles and
   * runs ShadowCasting and Precise Permissive algoritms
   * on it, printing out the results in stdout.
   * @param args
   */
  public static void main(String[] args)
  {
    ExampleBoard b = new ExampleBoard(21, 21);
    Random rand=new Random();
    for(int i=0; i<30; i++) {
      b.setObstacle(rand.nextInt(21), rand.nextInt(21));
    }
   
    System.out.println("ShadowCasting");
    IFovAlgorithm a=new ShadowCasting();
    a.visitFieldOfView(b, 10, 10, 9);
    b.print(10, 10);
   
    b.resetVisitedAndMarks();
    System.out.println("Precise Permissive");
    a=new PrecisePermissive();
    a.visitFieldOfView(b, 10, 10, 9);
    b.print(10, 10);
  }
}
TOP

Related Classes of transientlibs.rlforj.examples.FovExample

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.