@Override
    public IGameReaction getReaction(IPlaygroundState state) {
        List<IGameReaction> possibilities = memory.getPossibleReactions(state);
        if (!memory.isStateKnown(state) && possibilities.isEmpty()) {
            possibilities.addAll(gameReactionCreator.getPossibleReactions(state));
            for (IGameReaction possibility : possibilities) {
                // never lost with this move, because never played with this
                // move :)
                memory.setIsReactionGood(state.getHash(), possibility, true);
            }
        }
        possibilities = rulesFilter(possibilities, state);

        StringBuilder sb = new StringBuilder();
        for (IGameReaction possible : possibilities) {
            sb = sb.append(possible.toString()).append(',');
        }
        if (sb.length() > 0) {
            sb = sb.deleteCharAt(sb.length() - 1);
        }
        logging.printLine(name + ": Moznosti(" + possibilities.size() + "): " + sb.toString());
        if (possibilities.size() == 1) {
            lastState = state.getHash();
            lastReaction = possibilities.get(0);
            logging.printLine(name + ":Taham " + ((NIMGameReaction) lastReaction).getTake());
            return lastReaction;
        } else if (possibilities.size() > 1) {
            lastState = state.getHash();
            lastReaction = possibilities.get(brain.nextInt(possibilities.size()));
            logging.printLine(name + ":Taham " + ((NIMGameReaction) lastReaction).getTake());
            return lastReaction;
        } else {
            // resign
            logging.printLine(name + ":Nemam co tahat, vzdavam sa");
            return null;
        }
    }