Exactly, but in the rule:
> ;;; > > (defrule control-nulo > > (declare (salience 1000)) > > (fase (es "nil3")) > (yo_ball ?yb) > > (comp1_ball ?c1b) > > (comp2_ball ?c2b) >(test (neq nil ?yb)) > > (test (neq nil ?c1b)) > > (test (neq nil ?c2b)) > > ?fase<-(fase(es "nil3")) > > => > > (printout t "Ninguno de los sensores es nil" crlf) > > (modify ?fase(es "jugar")) > > ) I´m trying do >(test (neq nil ?yb) and (test (neq nil ?c1b)) to avoid the numbers were "nil" and then I get the next error: > Exception in thread "Thread-2" java.lang.NullPointerException > > at Player.TakeStep(Player.java:212) > > at EDU.gatech.cc.is.abstractrobot.ControlSystemS.takeStep > (ControlSystemS.java:127) > > at TBSim.SimulationCanvas.run(SimulationCanvas.java:971) > > at java.lang.Thread.run(Unknown Source) The program doesn´t work if I do the "test" with ?yb and with ?c1b. ----Mensaje original---- De: [EMAIL PROTECTED] Recibido: 19/06/2007 22:17 Para: <[email protected]> Asunto: Re: JESS: error in test To me, the error message seems very straightforward: one of the variables used on the line (> ?yb ?c1b) is nil (i.e., null) instead of being a number. ">" requires both its arguments to be numbers. To fix, look at the rule where this test appears, look where the variables come from, trace backwards to where the values should come from, and figure out why they're nil. On Jun 19, 2007, at 3:40 PM, [EMAIL PROTECTED] wrote: > Hello. > > I get the next error: > > Jess reported an error in routine > > > while executing (> ?yb ?c1b) > > while executing 'test' CE > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (Node2) > > while executing rule LHS (TEQ) > > while executing rule LHS (TECT) > > while executing (modify ?fase (es "jugar")) > > while executing defrule MAIN::control-nulo > > while executing (run). > > Message: Not a number: nil. > > ------ > > > I´m trying do: > > > (deffacts robots_ball > > (yo_ball (fetch "difyo_ball")) > > (yo_myport (fetch "difyo_myport")) > > (yo_suport (fetch "difyo_suport")) > > (comp1_ball (fetch "distcomp_ball1")) > > (comp2_ball (fetch "distcomp_ball2")) > > (comp1_yo (fetch "distcomp_yo1")) > > (comp2_yo (fetch "distcomp_yo2")) > > (comp1_miport (fetch "distcomp_miport1")) > > (comp2_miport (fetch "distcomp_miport2")) > > (comp1_suport (fetch "distcomp_suport1")) > > (comp2_suport (fetch "distcomp_suport2")) > > ) > > ;;; > > (defrule control-nulo > > (declare (salience 1000)) > > (fase (es "nil3")) > > (comp1_ball ?c1b) > > (comp2_ball ?c2b) > > (test (neq nil ?c1b)) > > (test (neq nil ?c2b)) > > ?fase<-(fase(es "nil3")) > > => > > (printout t "Ninguno de los sensores es nil" crlf) > > (modify ?fase(es "jugar")) > > ) > > ;;; > > (defrule portero0 "portero si soy el que está mas lejos de la > pelota y más cerca de la portería de todos mis compañeros" > > (declare (salience 500)) > > (fase (es "jugar")) > > (yo_ball ?yb) > > (yo_myport ?yp) > > (comp1_miport ?c1p) > > (comp2_miport ?c2p) > > (comp1_ball ?c1b) > > (comp2_ball ?c2b) > > (sensores(mi_porteria_x ?mpx)(mi_porteria_y ?mpy)(num_jugador ?nj)) > > (test (> ?yb ?c1b)) > > (test (> ?yb ?c2b)) > > (test (< ?yp ?c1p)) > > (test (< ?yp ?c2p)) > > ?mover<-(mover) > > > > > > => > > > (printout t "SOY EL PORTERO AHORA" ?nj crlf) > > (modify ?mover(eje_x ?mpx)(eje_y ?mpy)(velocidad 1)(chutar 0)) > > (assert (portero)) > > ) > > > ;;; > > > And I´m calling from JAVA with: > > for(i = 1; i < teammates.length+1; i++){ > > > > > cadena2= "distcomp_ball" + i; > > Vec2 aux = new Vec2 ( teammates[i-1].x - ball.x, teammates [i-1].y > - ball.y); > > > > jess_engine.store(cadena2, new Value (aux.r, RU.FLOAT)); > > > } > > > Then, if I use > > ;;;(test (neq nil ?c1b)) > > ;;;(test (neq nil ?c2b)) > > > I get the error as stated above and if i use without ;;; > (comments), I get in JAVA a fatal error and it doesn´t work: > > Exception in thread "Thread-2" java.lang.NullPointerException > > at Player.TakeStep(Player.java:212) > > at EDU.gatech.cc.is.abstractrobot.ControlSystemS.takeStep > (ControlSystemS.java:127) > > at TBSim.SimulationCanvas.run(SimulationCanvas.java:971) > > at java.lang.Thread.run(Unknown Source) > > ---------------- > > I don´t why is it going on!!! Any help or suggestion? > > Thanks for all. > > Ricardo. --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED] com' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] gov. -------------------------------------------------------------------- -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
