Change cell linking method using new Cardinal methods
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* This class is cell of the board of the Gomoku game.
|
||||
*/
|
||||
@@ -137,9 +136,8 @@ public class GomokuCell{
|
||||
|
||||
public static void link(GomokuCell c1, GomokuCell c2, Cardinal c1Toc2){
|
||||
if (c1 == null || c2 == null) return ;
|
||||
List<Cardinal> cardinals = Arrays.asList(Cardinal.values());
|
||||
c1.linkCell(c1Toc2, c2);
|
||||
c2.linkCell(cardinals.get((cardinals.indexOf(c1Toc2) + 4) % 8), c1);
|
||||
c2.linkCell(c1Toc2.inverse(), c1);
|
||||
}
|
||||
|
||||
//------------------Overides--------------------------
|
||||
|
||||
Reference in New Issue
Block a user