ArrayList<ArrayList<IndexPosition>> getFindWord(Participant p, String commandText) {
    commandText = _language.normalizeString(commandText);
    if (commandText.contains(" ")) return null;
    final HashMap<IndexPosition, Token> tokenIndexByPosition = getTokenIndexByPosition();
    HashMap<String, ArrayList<IndexPosition>> index =
        new HashMap<String, ArrayList<IndexPosition>>();
    HashMap<IndexPosition, String> rindex = new HashMap<IndexPosition, String>();
    for (Entry<IndexPosition, Token> entry : tokenIndexByPosition.entrySet()) {
      BoardToken value = (BoardToken) entry.getValue();
      rindex.put(entry.getKey(), value.letter);

      if (!index.containsKey(value.letter)) index.put(value.letter, new ArrayList<IndexPosition>());
      index.get(value.letter).add(entry.getKey());
    }
    ArrayList<ArrayList<IndexPosition>> paths = new ArrayList<ArrayList<IndexPosition>>();
    boolean isFirstLetter = true;
    for (String letter : _language.tokens(commandText)) {
      ArrayList<IndexPosition> matches = index.get(letter);
      if (null == matches) return null;
      ArrayList<ArrayList<IndexPosition>> newpaths = new ArrayList<ArrayList<IndexPosition>>();
      for (IndexPosition match : matches) {

        if (isFirstLetter) {
          ArrayList<IndexPosition> a = new ArrayList<IndexPosition>();
          a.add(match);
          newpaths.add(a);
        } else {
          for (ArrayList<IndexPosition> path : paths) {
            IndexPosition indexPosition = path.get(path.size() - 1);
            if (match.is2dAdjacentTo(indexPosition) && !path.contains(match)) {
              path = new ArrayList<IndexPosition>(path);
              path.add(match);
              newpaths.add(path);
            }
          }
        }
      }
      if (newpaths.size() == 0) {
        return null;
      }
      paths = newpaths;
      isFirstLetter = false;
    }
    if (paths.size() == 0) {
      return null;
    }
    return paths;
  }
 boolean isAdjacent(final IndexPosition position, final IndexPosition prevPosition) {
   if (null == position) return false;
   if (null == prevPosition) return false;
   if (position.getCurveIndex() + 1 < prevPosition.getCurveIndex()) return false;
   if (position.getCurveIndex() - 1 > prevPosition.getCurveIndex()) return false;
   if (position.getCardIndex() + 1 < prevPosition.getCardIndex()) return false;
   if (position.getCardIndex() - 1 > prevPosition.getCardIndex()) return false;
   final boolean curveMatch = position.getCurveIndex() == prevPosition.getCurveIndex();
   final boolean cardMatch = position.getCardIndex() == prevPosition.getCardIndex();
   if (curveMatch && cardMatch) return true;
   if (curveMatch || cardMatch) return true;
   return true;
 }
 public Position getPosition(final IndexPosition key, final Player access) throws GameException {
   if ((key.getCurveIndex() >= 0) && (key.getCurveIndex() < NUM_ROWS))
     return basePosition
         .add(rowOffset.scale(key.getCurveIndex()))
         .add(columnOffset.scale(key.getCardIndex()));
   else if (CURVE_CMDS == key.getCurveIndex())
     return cmdPosition.add(cmdOffset.scale(key.getCardIndex()));
   else return _mplayerManager.getPosition(key, access);
 }
 BoardToken getGenerateToken(
     final int chainSize, final MarkovPredictor mk, final TokenArray a, final IndexPosition p) {
   return getGenerateToken(
       chainSize, mk, a, a.new ArrayPosition(p.getCurveIndex(), p.getCardIndex()));
 }