triceo / drooms

Drools-based competition in a Snake-like game
3 stars 3 forks source link

isolating player's strategies even more #2

Closed tomason closed 11 years ago

tomason commented 11 years ago

This pull request fixes the issue when it was possible to retrieve player's KnowledgeBase. Through it the StatefulKnowledgeSession could be retrieved and manipulated. That led to possibility of players influencing each others decisions.

triceo commented 11 years ago

Thanks!

triceo commented 11 years ago

The change seems to introduce strange CCEs when running DroomsTournament. What happens is:

1) First game on a particular playground passes OK. 2) Second game passes for as long as there are no reachable collectibles for my strategy. 3) Once there appears one reachable collectible, I get java.lang.ClassCastException: org.drooms.strategy.hungry.ReachableCollectible cannot be cast to org.drooms.strategy.hungry.ReachableCollectible

(Where ReachableCollectible is a fact type declared in my DRL.)

So far, it seems that when a second instance of ExecutorService is created (tournament creates second game => new CommandDistributor = new ExecutorService), all hell breaks loose. (This is confirmed by the fact that in single games, this doesn't happen.) Oh joy.

tomason commented 11 years ago

Interesting this problem can't be seen with random strategies that define their own FactType as well.

I also encountered similar problem with a class declared in java class. However the problem is only with @propertyReactive class and the problem is with building the rule itself (the second game is never run).

This appears also when only one game is played on the playground and next one is used then.

I'm currently looking at this issue.

triceo commented 11 years ago

I created an issue for this: #3.

tomason commented 11 years ago

I have resolved my problem as an issue in Drools. I have a workaround for it and the tournaments run with my strategy normally.

triceo commented 11 years ago

What was the solution? Perhaps it could be applied globally.