Advertisement
MarkTiukov

draughts_parsing

Oct 19th, 2021
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. Matcher positionMatcher = DraughtsPatterns.draughtPosition.matcher(line);
  2. if (line.contains("-")) {
  3.     String from = null, to = null;
  4.     if (positionMatcher.find())
  5.         from = positionMatcher.group(0);
  6.     if (positionMatcher.find())
  7.         to = positionMatcher.group();
  8.     makeMove(from, to);
  9. } else {
  10.     if (positionMatcher.find()) {
  11.         String from = positionMatcher.group();
  12.         while (positionMatcher.find()) {
  13.             String to = positionMatcher.group();
  14.             makeCapture(from, to);
  15.             from = to;
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement