ZornTaov

BINGO

Jan 5th, 2010
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer letter;//1,2,3,4,5 = B,I,N,G,O = 1,16,31,46,61
  2. integer number;
  3. string combo;
  4. list BINGOList = [];
  5. string BINGOCard;
  6. list BINGOCardLineB = [];
  7. list BINGOCardLineI = [];
  8. list BINGOCardLineN = [];
  9. list BINGOCardLineG = [];
  10. list BINGOCardLineO = [];
  11. string BINGOString;
  12.  
  13. makeList()
  14. {
  15.     integer i = 0;
  16.     integer length = 75;
  17.     for (; i < length; ++i)
  18.     {
  19.         BINGOList += [i+1];
  20.     }
  21. }
  22. seperateList()
  23. {
  24.     integer i = 0;
  25.     integer j = 0;
  26.     string BINGO;
  27.     integer length = 15;
  28.     integer times = 5;
  29.     for (; j < times; ++j)
  30.     {
  31.         if(j==0) BINGO = "B";
  32.         else if(j==1) BINGO = "I";
  33.         else if(j==2) BINGO = "N";
  34.         else if(j==3) BINGO = "G";
  35.         else if(j==4) BINGO = "O";
  36.         for (; i < length; ++i)
  37.         {
  38.             BINGOString += BINGO + llList2String(BINGOList, i) + ", ";
  39.         }
  40.         length += 15;
  41.         BINGOString += "\n";
  42.     }
  43. }
  44. makeCard()
  45. {
  46.     integer i = 0;
  47.     integer j = 0;
  48.     string BINGO;
  49.     list FREE = ["FREE"];
  50.     list BINGOCardTemp = [];
  51.     integer length = 15;
  52.     integer times = 5;
  53.     for (; j < times; ++j)
  54.     {
  55.        
  56.         for (; i < length; ++i)
  57.         {
  58.             BINGOCardTemp += [i];
  59.         }
  60.        
  61.         BINGOCardTemp = llListRandomize(BINGOCardTemp,1);
  62.         if(j==0) {BINGOCardLineB = llDeleteSubList(BINGOCardTemp,5,15);BINGOCardTemp = [];}
  63.         else if(j==1) {BINGOCardLineI = llDeleteSubList(BINGOCardTemp,5,14);BINGOCardTemp = [];}
  64.         else if(j==2) {BINGOCardLineN = llDeleteSubList(BINGOCardTemp,4,14);BINGOCardTemp = [];BINGOCardLineN = llListInsertList(BINGOCardLineN,FREE,2);}
  65.         else if(j==3) {BINGOCardLineG = llDeleteSubList(BINGOCardTemp,5,14);BINGOCardTemp = [];}
  66.         else if(j==4) {BINGOCardLineO = llDeleteSubList(BINGOCardTemp,5,14);BINGOCardTemp = [];}
  67.        
  68.         length += 15;
  69.        
  70.     }
  71.     BINGOCard += "\nB " + llList2CSV(BINGOCardLineB) + "\nI " + llList2CSV(BINGOCardLineI) + "\nN " + llList2CSV(BINGOCardLineN) + "\nG " + llList2CSV(BINGOCardLineG) + "\nO " + llList2CSV(BINGOCardLineO);
  72. }
  73. default
  74. {
  75.     state_entry()
  76.     {
  77.         makeList();
  78.         //llSay(0, llList2CSV(BINGOList));
  79.         seperateList();
  80.        // llSay(0, llList2CSV(BINGOString));
  81.         makeCard();
  82.         llSay(0, BINGOCard);
  83.     }
  84.     touch_start(integer n)
  85.     {
  86.         letter = (integer)llFrand(5)+1;
  87.         number = (integer)llFrand(15)+1;
  88.         if(letter == 1)
  89.         {
  90.             number += 0;
  91.             combo = "B"+(string)number;
  92.         }
  93.         else if(letter == 2)
  94.         {
  95.             number += 15;
  96.             combo = "I"+(string)number;
  97.         }
  98.         else if(letter == 3)
  99.         {
  100.             number += 30;
  101.             combo = "N"+(string)number;
  102.         }
  103.         else if(letter == 4)
  104.         {
  105.             number += 45;
  106.             combo = "G"+(string)number;
  107.         }
  108.         else if(letter == 5)
  109.         {
  110.             number += 60;
  111.             combo = "O"+(string)number;
  112.         }
  113.        
  114.         llSay(0, combo);
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment