# Progress: Piece Contouring Skeleton

Started on some skeleton methods for piece contouring but I have become tired and hungry. I figure I’ll post this before I forget and come back to it later today.

Anyway, the method goes like this: When the agent elects to explore, it is redirected to a semi-guided method for finding an optimal-ish position. This method tries to find the best place for the given piece with any rotation. The ‘best’ (perfect fit) position may not exist, so it also looks for similar contours for minimal gaps. This is done with a recursive method which finds the best among many possibilities.

The test skeletons are up too, but should be filled in before any code to help me wrap my head around it.

Update: Later on, I managed to fill in the test methods, so now the methods should be testable. I wrote some more notes down as well that should help explain the algorithm:
Place piece at best position (the initially given contour array). Otherwise, scan for a similar state by recursing and looking at states that go up (+1) at the first index (So {1,0,-1} -> {2,0,-1}) and states that go down (-1) at the last index (So {1,0,-1} becomes {1,0,-2}). This will give 2 more contour to look at each step. Recurse until:
a) The contour is found,
b) The vector is at it’s limits and can’t recurse ({2,0,-2} or {-2,2} or {2} or {-2}),
c) Or the recursion goes to lvl X (X’ll likely be 2) depth.

If at case b or c, return a random Tetromino with depth value Integer.MAX. For each level recursed, add 1 to the depth value.

This method will be called on each rotation of the piece, and whichever nets the best depth value will be used.

Not a perfect method, but it should suffice for the majority of the time.

Also, added a toString to SubState just for ease in debugging.