예제 #1
0
 static void AddSand(Dictionary <HexCoordinate, ulong> NextState, HexCoordinate coordinate, ulong sand)
 {
     if (!NextState.ContainsKey(coordinate))
     {
         NextState.Add(coordinate, sand);
     }
     else
     {
         NextState[coordinate] += sand;
     }
 }
예제 #2
0
        PointF[] BoundaryPoints(HexCoordinate coordinate)
        {
            float centerX = originX + cellRadius * coordinate.X * 1.5f;
            float centerY = originY + cellRadius * (-coordinate.X * Root3Over2 - coordinate.Y * 2 * Root3Over2);

            PointF[] boundary = new PointF[6];
            boundary[0] = new PointF(centerX + cellRadius * 1, centerY + cellRadius * 0);
            boundary[1] = new PointF(centerX + cellRadius * 0.5f, centerY + cellRadius * Root3Over2);
            boundary[2] = new PointF(centerX - cellRadius * 0.5f, centerY + cellRadius * Root3Over2);
            boundary[3] = new PointF(centerX - cellRadius * 1, centerY + cellRadius * 0);
            boundary[4] = new PointF(centerX - cellRadius * 0.5f, centerY - cellRadius * Root3Over2);
            boundary[5] = new PointF(centerX + cellRadius * 0.5f, centerY - cellRadius * Root3Over2);

            return(boundary);
        }