Detecting collision when rotating a shape/piece
- Created Wednesday, August 12th 2015 @ 18:30:01
So I'm trying to implement a path finding algorithm for the tetris pieces using breadth first search. When I restrict the bot to only try out left/right/down it works as desired, but when I add rotations the bot outputs moves that are not possible for the current state.
I'm using the Java starterbot which already has methods to check if a cell is "out of bounds" or "has a collision". This works for all moves except rotations, so I wondered if I should use something else here.
After trying to find other ways of detecting a collision properly, and failing at it, I'd like to know a suggestion on how I can handle this problem.
Thanks.
- Created Wednesday, August 12th 2015 @ 18:38:08
Notice that pieces "migrate" during rotation. For example if you rotate "I" piece two times, it will be lower than original position.
- Created Wednesday, August 12th 2015 @ 19:06:23
Yes, but the location of the matrix it's inside of doesn't change right? Only the position of the piece inside it's matrix changes as far as I know.
- Created Wednesday, August 12th 2015 @ 20:41:46
Alright, the issue was due to something unrelated with checking collisions. A "<" instead of "!=" can make all the difference in the world...
- Updated Wednesday, August 12th 2015 @ 22:36:31
Notice that pieces "migrate" during rotation. For example if you rotate "I" piece two times, it will be lower than original position.
I thought BlockBattle doesn't use SRS for which this is the case?
- Created Thursday, August 13th 2015 @ 08:54:53
Thanks, the only difference here is that "O" piece is located inside 2x2 matrix.