Advertisement
Guest User

Untitled

a guest
Apr 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var _tempList;
  2.  
  3. while(ds_grid_height(genList) != 1){
  4. _tempList = ds_grid_create(3,1);
  5.  
  6. for (var i = 1; i < ds_grid_height(genList);i++){
  7. var rOpen = (choose(true,false) && rmGrid[# genList[# 0,i]+1, genList[# 1,i]] == null && rmGrid[# genList[# 0,i]+1, genList[# 1,i]] != undefined)
  8. var uOpen = (choose(true,false) && rmGrid[# genList[# 0,i], genList[# 1,i]-1] == null && rmGrid[# genList[# 0,i], genList[# 1,i]-1] != undefined)
  9. var lOpen = (choose(true,false) && rmGrid[# genList[# 0,i]-1, genList[# 1,i]] == null && rmGrid[# genList[# 0,i]-1, genList[# 1,i]] != undefined)
  10. var dOpen = (choose(true,false) && rmGrid[# genList[# 0,i], genList[# 1,i]+1] == null && rmGrid[# genList[# 0,i], genList[# 1,i]+1] != undefined)
  11.  
  12. if rOpen+uOpen+lOpen+dOpen = 0{
  13.     if _tempList[# 2,i] != undefined{
  14.         rmGrid[# genList[# 0,i], genList[# 1,i]] = power(_tempList[# 2,i],2);
  15.         break;
  16.     }
  17. }else{
  18.    
  19.     var _right = rOpen || genList[# 2,i] == 1;
  20.     var _up = uOpen || genList[# 2,i] == 2;
  21.     var _left = lOpen || genList[# 2,i] == 3;
  22.     var _down = dOpen || genList[# 2,i] == 4;
  23.    
  24.     rmGrid[# genList[# 0,i], genList[# 1,i]] = right*_right+up*_up+left*_left+down*_down;
  25.    
  26. }
  27.  
  28. genList[# 3,i] = undefined;
  29. //for (var i = 1; i < ds_grid_height(_tempList); i++){
  30. //  _tempList[# 2,i] = null;
  31. //  _tempList[# 3,i] = null;
  32. //  _tempList[# 4,i] = null;
  33. //  _tempList[# 5,i] = null;
  34. //}
  35. if rOpen = true && genList[# 2,i] != 1{
  36.     ds_grid_resize(_tempList,3,ds_grid_height(_tempList)+1);
  37.     _tempList[# 0,ds_grid_height(_tempList)-1] = genList[# 0,i]+1;
  38.     _tempList[# 1,ds_grid_height(_tempList)-1] = genList[# 1,i];
  39.    
  40.     _tempList[# 2,ds_grid_height(_tempList)-1] = 3; // set next rooms left door open
  41.    
  42. }
  43. if uOpen = true{
  44.     ds_grid_resize(_tempList,3,ds_grid_height(_tempList)+1);
  45.     _tempList[# 1,ds_grid_height(_tempList)-1] = genList[# 1,i]-1;
  46.     _tempList[# 0,ds_grid_height(_tempList)-1] = genList[# 0,i];
  47.    
  48.     _tempList[# 2,ds_grid_height(_tempList)-1] = 4; // set next rooms bottom door open
  49. }
  50. if lOpen = true{
  51.     ds_grid_resize(_tempList,3,ds_grid_height(_tempList)+1);
  52.     _tempList[# 0,ds_grid_height(_tempList)-1] = genList[# 0,i]-1;
  53.     _tempList[# 1,ds_grid_height(_tempList)-1] = genList[# 1,i];
  54.    
  55.     _tempList[# 2,ds_grid_height(_tempList)-1] = 1; // set next rooms right door open
  56. }
  57. if dOpen = true{
  58.     ds_grid_resize(_tempList,3,ds_grid_height(_tempList)+1);
  59.     _tempList[# 1,ds_grid_height(_tempList)-1] = genList[# 1,i]+1;
  60.     _tempList[# 0,ds_grid_height(_tempList)-1] = genList[# 0,i];
  61.    
  62.     _tempList[# 2,ds_grid_height(_tempList)-1] = 2; // set next rooms up door open
  63. }
  64. }
  65. ds_grid_copy(genList,_tempList);
  66. ds_grid_destroy(_tempList);
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement