//moves a stone (destination is propably not the real destination; real destination is return value) private Field MoveStone(Field source, Field destination) { string direction = GetDirection(source, destination); PlQuery query = new PlQuery("moveStone", new PlTermV(source.ToTerm(), new PlTerm(direction), new PlTerm("NewDestination"))); PlTermV termV = query.Solutions.FirstOrDefault(); return termV.Size == 0 ? default(Field) : new Field(termV[2]); }
//check for more hits private IEnumerable<Field> MoreHitsPossible(Field source) { PlQuery query = new PlQuery("areMoreHitsPossible", new PlTermV(source.ToTerm(), new PlTerm("Hits"))); PlTermV termV = query.Solutions.FirstOrDefault(); if (termV.Size == 0) return new List<Field>(); IEnumerable<PlTerm> list = termV[1].ToList(); return list.Select<PlTerm, Field>((t) => new Field(t)).ToList(); }