Advertisement
KSSBrawl_

Panel de Pon player board generation procedure

Dec 23rd, 2018
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. Panel de Pon stores the 14 possible initial layouts for the player's board as lists of 6 bytes saying how many panels are in each of the columns, going from left to right. The full list goes as follows:
  2.  
  3. 6,4,5,5,5,5
  4. 4,5,6,5,5,5
  5. 5,5,5,5,4,6
  6. 5,6,5,6,3,5
  7. 6,5,6,1,6,6
  8. 6,0,6,6,6,6
  9. 6,6,6,0,6,6
  10. 6,1,6,5,6,6
  11. 3,6,6,6,3,6
  12. 6,3,6,6,6,3
  13. 6,4,6,6,2,6
  14. 6,5,6,6,1,6
  15. 6,2,3,7,6,6
  16. 5,7,3,6,6,3
  17.  
  18. Let's take the second-to-last one as an example. If that one is chosen by the game, the board will look like this:
  19.  
  20. ------------
  21. ------------
  22. ------------
  23. ------------
  24. ------------
  25. ------[]----
  26. []----[][][]
  27. []----[][][]
  28. []----[][][]
  29. []--[][][][]
  30. [][][][][][]
  31. [][][][][][]
  32.  
  33. Once the game has chosen a layout to use, it will begin to fill in random colors for the panels from bottom to top, left to right, using the following algorithm:
  34.  
  35. 1. Before starting, check to see if the current column is empty, and skip to the next one if so.
  36. 2. Generate a random 8-bit value (can be anywhere from 0-255.)
  37. 3. Mask away the high nybble (the 4 highest bits) to get a value from 0-15.
  38. 4. Check to see if the value is 0 (corresponds to an empty space), and throw away the value and go back to step 2 if it is.
  39. 5. Compare the value against a given limit for the number of colors, and throw the value away and go back to step 2 if it exceeds that limit.
  40. 6. Compare the value to the color of the last panel the game generated, and throw away the value and go back to step 2 if they match.
  41. 7. Compare the value to the color of the space to the left, and throw away the value and go back to step 2 if they match.
  42. 8. If the value passes all these tests, set the color of the current space to this value, move to the next space, then return to step 1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement