Examples of ExpList


Examples of cs227b.teamIago.resolver.ExpList

    }
    return fluents;
  }
 
  public Collection<Term> getSeesTerms(GameState state, RoleInterface<Term> role, JointMoveInterface<Term> jointMove) {
    ExpList movesList = getMovesListForJointMove(jointMove);
    ExpList el = null;
    synchronized (gameSim) {
      gameSim.SetGameState(state);
      el = gameSim.getSeesTerms(role.getTerm().getExpr(), movesList);
    }
    Collection<Term> terms;
    if (el != null) {
      terms = new Vector<Term>(el.size());
      for(int i=0;i<el.size();i++) {
        terms.add(new Term(el.get(i)));
      }
    } else {
      terms = Collections.emptyList();
    }
    return terms;
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

    }
    return terms;
  }
 
  public Collection<Term> getSeesXMLTerms(GameState state, RoleInterface<Term> role) {
    ExpList el = null;
    synchronized (gameSim) {
      gameSim.SetGameState(state);
      Expression r = role.getTerm().getExpr();
      el = gameSim.getSeesXMLTerms(r);
    }
    Collection<Term> terms;
    if (el != null) {
      terms = new Vector<Term>(el.size());
      for(int i=0;i<el.size();i++) {
        terms.add(new Term(el.get(i)));
      }
    } else {
      terms = Collections.emptyList();
    }
    return terms;
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

    return terms;
  }
 
  public GameState getStateFromString(String state) throws InvalidKIFException {
    // get list of fluents
    ExpList el = ParserAdapter.parseExpressionList(state);
   
    // surround with (true ...)
    Expression[] exps = new Expression[el.size()];
    for (int i = 0; i < el.size(); i++) {
      Expression e = el.get(i);
      exps[i] = new Predicate("true", new Expression[] {e});
    }
    // add to theory and extract the GameState
    Theory t = new Theory(true, false);
    t.setState(new ExpList(exps));
    GameState gs = t.getState();
    return gs;
  }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

public class ParserAdapter {

  public static Expression parseExpression(String kif) throws InvalidKIFException {
    try{
      ExpList list=Parser.parseDesc("(bla "+kif+")");
      if(list.size() == 1){
        ExpList list2=((Connective)list.get(0)).getOperands();
        if(list2.size() == 1) {
          return list2.get(0);
        }
      }
    }catch(Exception ex){
      throw new InvalidKIFException("Exception while parsing \""+kif+"\":"+ex.getMessage());
    }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

    try{
      kif = kif.replace(")", ") ").trim();
      if(kif.charAt(0) != '(' || kif.charAt(kif.length()-1) != ')')
        throw new InvalidKIFException("not a valid kif list:"+kif);
      kif = "(bla " + kif.substring(1, kif.length()).trim();
      ExpList list=Parser.parseDesc(kif);
      if(list.size() != 1){
        throw new InvalidKIFException("Exception while parsing \""+kif+"\":...");
      }
      return ((Connective)list.get(0)).getOperands();
    }catch(Exception ex){
      throw new InvalidKIFException("Exception while parsing \""+kif+"\":"+ex.getMessage());
    }
  }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

   * this calculates the sees terms to send to "player", given that the previous moves are "moves"
   * "moves" is useful because does(Player,Action) may appear in the "sees" relation's body
   *     (like the next relation)
   */
  public ExpList getSeesTerms(Expression player, ExpList moves) {
    ExpList el = null;
    theoryObj.add(moves);
    ExpList seesArgs = new ExpList();
    seesArgs.add(player);
    seesArgs.add(vX);
    try {
      el = theoryObj.finds(vX, new Predicate(aSees,seesArgs));
    } catch (InterruptedException e) {
      wasInterrupted = true;
    }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

 
  /**
   * this calculates the sees terms to put in the XML file for the visualization
   */
  public ExpList getSeesXMLTerms(Expression player) {
    ExpList el = null;
    ExpList seesArgs = new ExpList();
    seesArgs.add(player);
    seesArgs.add(vX);
    try {
      el = theoryObj.finds(vX, new Predicate(aSeesXML,seesArgs));
    } catch (InterruptedException e) {
      wasInterrupted = true;
    }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

    Iterator myIt = myLists.iterator();
    long curHash = 0;

    for (; myIt.hasNext();)
    {
      ExpList myList = (ExpList) myIt.next();
      curHash += myList.hashCode();
    }
//    System.err.print("Hash: " + curHash + "   ");
    return (int)curHash;
   
  }
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

      Iterator myIt = myLists.iterator();
      Iterator hisIt = hisLists.iterator();

      for (; myIt.hasNext();)
      {
        ExpList myList = (ExpList) myIt.next();
        ExpList hisList = (ExpList) hisIt.next();
        if (hisList.size() != myList.size()) {
          ret = false;
          break;
        }
        if (!hisList.containsAll(myList)) {
          ret = false;
          break;
        }
      }
//      System.err.println("Objects equal? " + ret);
View Full Code Here

Examples of cs227b.teamIago.resolver.ExpList

    nestDepth = roles.size();
    moves = new ExpList[nestDepth];
    int[] roleSize = new int[nestDepth];
    for (int i = 0; i < nestDepth; i++)
    {
      ExpList mvs = ggp.GetLegalMoves(roles.get(i));
      moves[i] = mvs;
      roleSize[i] = mvs.size();
    }
    setLimits(roleSize);   
  }
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.