Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- |0 0 0|
- |0 0 0| (0 is empty, 1 is generated block)
- |0 0 1|
- _ _ _ Bottom->Mid Right->Mid Top->Mid Left->Mid
- |0 0 0|0 0 0|0 1 0| |1 0 0| |1 1 0| |1 1 1| |1 1 1|
- |0 0 0|0 0 0|0 1 1| |1 0 0| |1 1 1| |1 1 1| |1 1 1| -> Win! Generate
- |1 0 0|0 0 0|0 1 1| |0 0 0| |0 1 1| |0 1 1| |1 1 1| another game.
- _ _ _
- |0 0 0|
- |1 0 0|
- |1 0 0|
- // (left->right, top->right->botttom->left, top... it doesn't have to be all 4 directions)
- Random the right direction order.
- Generate all possible coordinates from all the directions from the path above.
- Initialize an empty list to store all chosen coordinates.
- While(!(Generate enough x*x block))
- {
- Remove one coordinate from all possible coordinates and add it into chosen list.
- if (!(Perform a check with the right order and the chosen list.))
- Remove it from the chosen list.
- }
- |0 0 0| |0 0 1|
- |0 0 1| |0 0 1|
- |0 0 1| |0 0 1|
- _ _ _ _ _ _
- |0 1 0|0 0 0|0 0 0| |0 1 0|0 0 0|0 0 0|
- |1 0 0|0 0 0|0 0 0| |1 0 0|0 0 0|0 0 0|
- |1 0 0|0 0 0|0 0 0| |1 0 0|0 0 0|0 0 0|
- _ _ _ _ _ _
- |0 1 0| |0 1 0|
- |0 1 0| |0 1 0|
- |0 0 0| |0 0 0|
- At this point the logic is wrong But if I add 1 more block to the
- with Top->Left->Bottom order. top grid, it'll become right.
Add Comment
Please, Sign In to add comment