xxMattewxx

Untitled

Mar 25th, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. bool CheckTreeRecursive(int64_t seed, JavaRnd rnd, int count, int treesFound, int chosenX, int chosenZ) {
  2. if(count == 10) {
  3. if(treesFound == 15) {
  4. return true;
  5. }
  6.  
  7. return false;
  8. }
  9.  
  10. int x = rnd.nextInt(16) + 8;
  11. int z = rnd.nextInt(16) + 8;
  12. int type = rnd.nextInt(3) == 0 ? 1 : 2;
  13. bool isvalid = false;
  14.  
  15. if(seed == 43195804)
  16. printf("%d %d %d\n", x, z, type);
  17.  
  18. if(chosenX == -1) {
  19. if(type == 1) return false;
  20. if(rnd.nextInt(4) != 2) return false; //l
  21. if(rnd.nextInt(2) != 1) return false; //i1
  22. if(rnd.nextInt(2) != 0) return false; //k1
  23. if(rnd.nextInt(2) != 1) return false; //k2
  24. if(rnd.nextInt(3) != 0) return false; //i4
  25.  
  26. isvalid = true;
  27. chosenX = x;
  28. chosenZ = z;
  29. treesFound |= 1;
  30.  
  31. return CheckTreeRecursive(seed, rnd, count + 1, treesFound, chosenX, chosenZ);
  32. }
  33. else {
  34. if(x == chosenX && z == chosenZ + 6 && (treesFound & 2) == 0) {
  35. if(type != 2) return false; //fuck that branch
  36.  
  37. isvalid = true;
  38. treesFound |= 2;
  39. }
  40. else if(x == chosenX + 7 && z == chosenZ + 4 && (treesFound & 4) == 0) {
  41. if(type != 2) return false; //fuck that branch
  42.  
  43. isvalid = true;
  44. treesFound |= 4;
  45. }
  46. else if(x == chosenX - 8 && z == chosenZ + 10 && (treesFound & 8) == 0) {
  47. if(type != 2) return false; //fuck that branch
  48.  
  49. isvalid = true;
  50. treesFound |= 8;
  51. }
  52. }
  53.  
  54. if(type == 1) {
  55. AssumeTaiga1Shenanigans(&rnd);
  56.  
  57. return CheckTreeRecursive(seed, rnd, count + 1, treesFound, chosenX, chosenZ);
  58. }
  59. else {
  60. //assume it didn't spawn
  61. AssumeTaiga2Shenanigans(&rnd);
  62.  
  63. bool ret1 = CheckTreeRecursive(seed, rnd, count + 1, treesFound, chosenX, chosenZ);
  64.  
  65. //cut branches that we know didn't spawn
  66. if(!isvalid)
  67. return ret1;
  68.  
  69. //coord above matches, assume it did spawn
  70. AssumeTaiga2ExtraShenanigans(&rnd);
  71.  
  72. return ret1 || CheckTreeRecursive(seed, rnd, count + 1, treesFound, chosenX, chosenZ);
  73. }
  74. }
Add Comment
Please, Sign In to add comment