Checkers game

  1. /*
  2.  * Jess.java
  3.  *
  4.  * Created on 26. november 2004, 10:10
  5.  */
  6.  
  7. package checkers;
  8. import jess.*;
  9.  
  10. /**
  11.  * Jess player
  12.  * @author k380h11
  13.  */
  14. public class Jess extends Player {
  15.    
  16.     /**
  17.      * Creates a new instance of Jess
  18.      * @param id name of the player
  19.      * @param color color of the player
  20.      */
  21.     public Jess(String id, boolean color) {
  22.         super(id, color);
  23.     }
  24.     /**
  25.      * This method is used start the Jess program
  26.      */
  27.  
  28.     public void play() {
  29.         try {
  30.             Checker.r.reset();
  31.             for (int i=0 ; i< 3; i++) {
  32.             String turn = Boolean.toString(Checker.getInstance().getTurn()).toUpperCase ();
  33.             Checker.r.executeCommand("(assert (deepness "+ i +" "+ turn +"))");
  34.             Checker.r.executeCommand("(focus MOVEMENT)");
  35.             Checker.r.executeCommand("(run)");
  36.             turn = Boolean.toString(!Checker.getInstance().getTurn()).toUpperCase ();
  37.             Checker.r.executeCommand("(assert (deepness "+ i +" "+ turn +"))");
  38.             Checker.r.executeCommand("(focus MOVEMENT)");
  39.             Checker.r.executeCommand("(run)");
  40.             }
  41.  
  42.             Checker.r.executeCommand("(focus REASONING)");
  43.             Checker.r.executeCommand("(assert (find_max -1000))");
  44.             Checker.r.executeCommand("(run)");
  45.             sleep(500);
  46.         } catch (Exception e) {
  47.             System.err.println(e);
  48.         }
  49.     }
  50. }
  51.  

contact - link to this site