package rubys.ninja.experiments.zahlenpuzzle.game;

import rubys.ninja.experiments.zahlenpuzzle.board.Board;
import rubys.ninja.experiments.zahlenpuzzle.board.BoardSize;


public class OneEmptyAndSortedNumericRuleEnforcer implements RuleEnforcer {
    public boolean isAllowedToSwap(Board board, BoardSize pos1, BoardSize pos2) {
        return false;
    }

    public boolean isFinished(Board finishedBoard) {
        return false;
    }
}

@@ -43,19 +43,17 @@
 le.game;
-%0D%0A%0D
+%0A
 %0Aimport 
@@ -101,17 +101,16 @@
 d.Board;
-%0D
 %0Aimport 
@@ -166,13 +166,129 @@
 ize;
-%0D%0A%0D%0A%0D
+%0Aimport rubys.ninja.experiments.zahlenpuzzle.token.EmptyToken;%0Aimport rubys.ninja.experiments.zahlenpuzzle.token.Token;%0A%0A
 %0Apub
@@ -359,17 +359,16 @@
 forcer %7B
-%0D
 %0A    pub
@@ -441,17 +441,16 @@
  pos2) %7B
-%0D
 %0A       
@@ -454,31 +454,391 @@
     
-return false;%0D
+Token token1 = board.getTokenAt(pos1);%0A        Token token2 = board.getTokenAt(pos2);%0A%0A        boolean token1IsEmpty = token1 instanceof EmptyToken;%0A        boolean token2IsEmpty = token2 instanceof EmptyToken;%0A%0A        boolean areAdjacent = board.areAdjacent(pos1, pos2);%0A        boolean oneIsEmpty = token1IsEmpty != token2IsEmpty;%0A%0A        return areAdjacent && oneIsEmpty;
 %0A    %7D
-%0D%0A%0D
+%0A
 %0A   
@@ -886,17 +886,16 @@
 Board) %7B
-%0D
 %0A       
@@ -912,16 +912,13 @@
 lse;
-%0D
 %0A    %7D
-%0D
 %0A%7D
-%0D
 %0A

Implement isAllowedToSwap in OneEmptyAndSortedNumericRuleEnforcer