List<Implication> rules = info.getRules();
KnowledgeBase volatileKb = new BasicKB();
AbstractReasoner reasoner = new BasicReasoner(staticKb, rules, parser_);
Fact question = VariableFact.fromList( parser_.parse("init ?x") );
ProofContext context = new ProofContext(volatileKb, parser_);
List<GroundFact> init = reasoner.getAllAnswers( question, context );
// Make sure that we have a cache for all the initial truths
assertEquals( 18, init.size() );
RelationNameProcessor processor = new RelationNameProcessor(parser_.TOK_TRUE);
for ( GroundFact f : init )
volatileKb.setTrue ( processor.processFact(f) );
// Find out how many legal moves there are
List<GroundFact> legal = reasoner.getAllAnswers( makeFact( "legal white ?x" ),
context );
// Make sure there's the right amount of legal moves
assertEquals( 7, legal.size() );
// Is the game terminal?
assertNull( reasoner.getAnAnswer( makeFact( "terminal" ), context ) );
// Make some move
GroundFact does1 = (GroundFact) makeFact( "does white (move wk c 1 c 2)" );
GroundFact does2 = (GroundFact) makeFact( "does black noop" );
volatileKb.setTrue( does1 );
volatileKb.setTrue( does2 );
// Find the next state.
List<GroundFact> nextTruths = reasoner.getAllAnswers( makeFact( "next ?x" ),
context );
assertEquals( 18, nextTruths.size() );
}