If this question was in my Direction:
Yes, the two Tiles you mentioned are identical. Just with different Rotation and both with only one Neighbour, just at a different position.
You can of course use less tiles and calculate the rotation in code but in this case (and mainly because Skorpio already prepared them in all possible rotations) it makes the code much easier if you just simply set the binarys by only looking at the neighbours.
If you look inside my code: "
^" is in Java the XOR operator.
Java Notes: Bitwise OperatorsSo this Method (from /jadex/agentkeeper/util/Neighborhood.java):
- {l Code}: {l Select All Code}
// Now we adress the concrete Tiles:
for(Neighborcase ncase : neighborcases)
{
ret = ret ^ ncase.getValue();
}
Just build the binary-value with the different "neighborcases" I calculated somewhere else.
And then I parse it to an binary-string (to concat it with the prefix to load the concrete tile)
and calculate the "alternatives" for the ones who have 2 or 4 alternatives.
- {l Code}: {l Select All Code}
// System.out.println("ret als byte " + Integer.toBinaryString(ret));
String stringret = Integer.toBinaryString(ret);
return parseTilesets(stringret, alternatives);
The values for each neighborcase-position are (read it as Vector(x,y), VALUE) from my Neighborcass-Enum (/jadex/agentkeeper/util/Neighborcase.java):
( implizit are 1 = 00000001, 2 = 00000010, ... ,128 = 10000000)
- {l Code}: {l Select All Code}
CASE1(new Vector2Int(-1, -1), 1),
CASE2(new Vector2Int(0, -1), 2),
CASE3(new Vector2Int(1, -1), 4 ),
CASE4(new Vector2Int(1, 0), 8 ),
CASE5(new Vector2Int(1, 1), 16),
CASE6(new Vector2Int(0, 1), 32),
CASE7(new Vector2Int(-1, 1), 64),
CASE8(new Vector2Int(-1, 0), 128),
Hope that helps you!
cheers,
Flipflop