Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var bingoGoals = [];
- bingoGoals[1] = [
- { name: "Map Card", types: ["map"], weight: 0 },
- { name: "TM28 (Dig)", types: ["dig"], weight: 10 },
- { name: "Itemfinder", types: ["item"], weight: 0 },
- { name: "Radio Card", types: ["radio"], weight: 0 },
- ];
- bingoGoals[2] = [
- { name: "Koffing", types: ["gas"], weight: 6 },
- { name: "4 Different types of Poke Ball", types: ["ball"], weight: 0 },
- { name: "Give a Pokemon a haircut", types: ["snip"], weight: 0 },
- { name: "Charcoal", types: ["fire"], weight: 0 }
- ];
- bingoGoals[3] = [
- { name: "Call a Youngster", types: ["shorts"], weight: 0 },
- { name: "Magikarp", types: ["lol"], weight: 4 },
- { name: "Teach TM12 (Sweet Scent)", types: ["bug"], weight: 0 },
- { name: "Rattata", types: ["lol"], weight: 4 },
- ];
- bingoGoals[4] = [
- { name: "TM20 (Endure)", types: ["endure"], weight: 6 },
- { name: "Slowpoketail", types: ["money"], weight: 0 },
- { name: "Growlithe", types: ["grow"], weight: 4 },
- { name: "10 pokemon owned", types: ["pkmn"], weight: 0 }
- ];
- bingoGoals[5] = [
- { name: "Goldeen", types: ["oldeen"], weight: 4 },
- { name: "Onix", types: ["rock"], weight: 4 },
- { name: "Venonat", types: ["radar"], weight: 4 },
- { name: "Defeat all 4 trainers in National Park", types: ["park"], weight: 0 }
- ];
- bingoGoals[6] = [
- { name: "Cubone", types: ["money"], weight: 4 },
- { name: "Slowpoke", types: ["dopey"], weight: 4 },
- { name: "A Pokemon with 4 moves with STAB", types: ["tm"], weight: 0 },
- { name: "TM05 (Roar)", types: ["thirty"], weight: 0 }
- ];
- bingoGoals[7] = [
- { name: "Ariados", types: ["time"], weight: 2 },
- { name: "No money on hand or mom", types: ["cash"], weight: 0 },
- { name: "Farfetch'd", types: ["time"], weight: 4 },
- { name: "TM50 (Nightmare)", types: ["thirty"], weight: 0 }
- ];
- bingoGoals[8] = [
- { name: "3 eggs", types: ["egg"], weight: 0 },
- { name: "Kadabra", types: ["abra"], weight: 2 },
- { name: "Beedrill and Butterfree", types: ["buggy"], weight: 2 },
- { name: "Unown Pokedex", types: ["unown"], weight: 100 },
- { name: "Everstone", types: ["egg"], weight: 0 }
- ];
- bingoGoals[9] = [
- { name: "Noctowl", types: ["trees"], weight: 2 },
- { name: "Defeat a Ponyta", types: ["thirty"], weight: 4 },
- { name: "Aipom", types: ["pompom"], weight: 4 },
- { name: "Use no repels", types: ["repel", "instant"], weight: 0 },
- { name: "7 Different berries", types: ["berry"], weight: 0 }
- ];
- bingoGoals[10] = [
- { name: "TM40 (Swagger)", types: ["sandwich"], weight: 6 },
- { name: "Graveler", types: ["gravel"], weight: 2 },
- { name: "Do not heal at any Pokemon Centers", types: ["heal", "instant"], weight: 0 },
- { name: "Defeat all 8 trainers on route 32", types: ["train"], weight: 0 }
- ];
- bingoGoals[11] = [
- { name: "TM10 (Hidden Power)", types: ["time"], weight: 0 },
- { name: "Burn Sudowoodo", types: ["wtf"], weight: 2 },
- { name: "Phanpy", types: ["time"], weight: 4 },
- { name: "HM05 (Flash)", types: ["flash"], weight: 0 }
- ];
- bingoGoals[12] = [
- { name: "Azumarill", types: ["time"], weight: 2 },
- { name: "A Pokemon with Focus Energy", types: ["focus"], weight: 8 },
- { name: "Win Bug Catching contest", types: ["day"], weight: 0 },
- { name: "Corsola", types: ["rod"], weight: 4 }
- ];
- bingoGoals[13] = [
- { name: "Catch Shuckle", types: ["shuck"], weight: 4 },
- { name: "Do not use any TMs", types: ["tm", "instant"], weight: 0 },
- { name: "A shiny Pokemon", types: ["waters"], weight: 0 },
- { name: "Release starter before level 11", types: ["starter"], weight: 0 }
- ];
- bingoGoals[14] = [
- { name: "Miltank", types: ["time"], weight: 4 },
- { name: "TM 13 (Snore)", types: ["zzz"], weight: 0 },
- { name: "A Pokemon with 4 non-TM status moves", types: ["hop"], weight: 0 },
- { name: "Mystic Water", types: ["thirty"], weight: 0 }
- ];
- bingoGoals[15] = [
- { name: "20 TMs", types: ["tm"], weight: 0 },
- { name: "King's Rock", types: ["slow"], weight: 0 },
- { name: "Soft Sand", types: ["pro"], weight: 0 },
- { name: "Exp Share", types: ["whirl"], weight: 0 }
- ];
- bingoGoals[16] = [
- { name: "20 Pokemon owned", types: ["pkmn"], weight: 0 },
- { name: "Mantine", types: ["mant"], weight: 4 },
- { name: "Heracross", types: ["hera"], weight: 4 },
- { name: "Evolve Eevee", types: ["stone"], weight: 4 }
- ];
- bingoGoals[17] = [
- { name: "Stop starter evolving 6 times", types: ["starter"], weight: 1 },
- { name: "Wobbuffet", types: ["time"], weight: 4 },
- { name: "Xatu", types: ["alph"], weight: 2 },
- { name: "Defeat Lapras", types: ["day"], weight: 0 }
- ];
- bingoGoals[18] = [
- { name: "Poliwhirl", types: ["raise"], weight: 2 },
- { name: "Encounter Suicune on route 42", types: ["cune"], weight: 0 },
- { name: "Dunsparce", types: ["sparce"], weight: 4 },
- { name: "4 Rare Candies", types: ["rare"], weight: 5 }
- ];
- bingoGoals[19] = [
- { name: "A Pokemon with pursuit", types: ["suit"], weight: 8 },
- { name: "Pokemon with an evasion boosting move", types: ["ass"], weight: 4 },
- { name: "TM 46 (Thief)", types: ["whirl"], weight: 6 },
- { name: "Nidoking or Nidoqueen", types: ["nido"], weight: 1 }
- ];
- bingoGoals[20] = [
- { name: "Granbull", types: ["raise"], weight: 2 },
- { name: "Berry Juice", types: ["shuck"], weight: 5 },
- { name: "Max phonebook", types: ["battles"], weight: 0 },
- { name: "HM02 (Fly)", types: ["whee"], weight: 0 }
- ];
- bingoGoals[21] = [
- { name: "Mineralbadge", types: ["steel"], weight: 0 },
- { name: "80 Pokemon seen", types: ["pkmn"], weight: 0 },
- { name: "Electrode", types: ["elec"], weight: 2 },
- { name: "3 baby Pokemon", types: ["egg"], weight: 4 }
- ];
- bingoGoals[22] = [
- { name: "Bayleef", types: ["starter"], weight: 2 },
- { name: "TM21 (Frustration) or TM27 (Return)", types: ["day"], weight: 0 },
- { name: "A Pokemon with Flame Wheel", types: ["starter"], weight: 8 },
- { name: "Own 10 different Flying type Pokemon", types: ["pkmn"], weight: 2 }
- ];
- bingoGoals[23] = [
- { name: "3 level 30 Pokemon", types: ["red"], weight: 0 },
- { name: "Glacierbadge", types: ["whirl"], weight: 0 },
- { name: "Defeat 10 Pokemaniacs", types: ["harley"], weight: 0 },
- { name: "Sandslash", types: ["raise"], weight: 2 }
- ];
- bingoGoals[24] = [
- { name: "$50,000", types: ["money", "cash"], weight: 0 },
- { name: "Battle a Legendary Pokemon", types: ["ass"], weight: 0 },
- { name: "30 Pokemon owned", types: ["pkmn"], weight: 0 },
- { name: "Lanturn", types: ["raise"], weight: 2 }
- ];
- bingoGoals[25] = [
- { name: "Jumpluff", types: ["raise"], weight: 1 },
- { name: "Receive elixer from Fishing Guru", types: ["karp"], weight: 8 },
- { name: "Win a Battle Tower match", types: ["gg"], weight: 100 },
- { name: "6 Badges", types: ["whee"], weight: 0 }
- ];
- var bingo = function (aaaa) {
- var bingoList = bingoGoals;
- var size = 5;
- function gup(name) {
- name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
- var regexS = "[\\?&]" + name + "=([^&#]*)";
- var regex = new RegExp(regexS);
- var results = regex.exec(window.location.href);
- if (results == null)
- return "";
- else
- return results[1];
- }
- var LANG = gup('lang');
- if (LANG == '') LANG = 'name';
- var SEED = "" + aaaa;
- if (SEED == "") {
- window.location = '?seed=' + Math.ceil(999999 * Math.random());
- } else {
- var MODE = gup('mode');
- if (typeof size == 'undefined') size = 5;
- Math.seedrandom(SEED); //sets up the RNG
- var MAX_SEED = 999999; //1 million cards
- var lineCheckList = [];
- if (size == 5) {
- lineCheckList[1] = [1, 2, 3, 4, 5, 10, 15, 20, 6, 12, 18, 24];
- lineCheckList[2] = [0, 2, 3, 4, 6, 11, 16, 21];
- lineCheckList[3] = [0, 1, 3, 4, 7, 12, 17, 22];
- lineCheckList[4] = [0, 1, 2, 4, 8, 13, 18, 23];
- lineCheckList[5] = [0, 1, 2, 3, 8, 12, 16, 20, 9, 14, 19, 24];
- lineCheckList[6] = [0, 10, 15, 20, 6, 7, 8, 9];
- lineCheckList[7] = [0, 12, 18, 24, 5, 7, 8, 9, 1, 11, 16, 21];
- lineCheckList[8] = [5, 6, 8, 9, 2, 12, 17, 22];
- lineCheckList[9] = [4, 12, 16, 20, 9, 7, 6, 5, 3, 13, 18, 23];
- lineCheckList[10] = [4, 14, 19, 24, 8, 7, 6, 5];
- lineCheckList[11] = [0, 5, 15, 20, 11, 12, 13, 14];
- lineCheckList[12] = [1, 6, 16, 21, 10, 12, 13, 14];
- lineCheckList[13] = [0, 6, 12, 18, 24, 20, 16, 8, 4, 2, 7, 17, 22, 10, 11, 13, 14];
- lineCheckList[14] = [3, 8, 18, 23, 10, 11, 12, 14];
- lineCheckList[15] = [4, 9, 19, 24, 10, 11, 12, 13];
- lineCheckList[16] = [0, 5, 10, 20, 16, 17, 18, 19];
- lineCheckList[17] = [15, 17, 18, 19, 1, 6, 11, 21, 20, 12, 8, 4];
- lineCheckList[18] = [15, 16, 18, 19, 2, 7, 12, 22];
- lineCheckList[19] = [15, 16, 17, 19, 23, 13, 8, 3, 24, 12, 6, 0];
- lineCheckList[20] = [4, 9, 14, 24, 15, 16, 17, 18];
- lineCheckList[21] = [0, 5, 10, 15, 16, 12, 8, 4, 21, 22, 23, 24];
- lineCheckList[22] = [20, 22, 23, 24, 1, 6, 11, 16];
- lineCheckList[23] = [2, 7, 12, 17, 20, 21, 23, 24];
- lineCheckList[24] = [20, 21, 22, 24, 3, 8, 13, 18];
- lineCheckList[25] = [0, 6, 12, 18, 20, 21, 22, 23, 19, 14, 9, 4];
- }
- function mirror(i) {
- if (i == 0) { i = 4; }
- else if (i == 1) { i = 3; }
- else if (i == 3) { i = 1; }
- else if (i == 4) { i = 0; }
- return i;
- }
- function difficulty(i) {
- // To create the magic square we need 2 random orderings of the numbers 0, 1, 2, 3, 4.
- // The following creates those orderings and calls them Table5 and Table1
- var Num3 = SEED % 1000; // Table5 will use the ones, tens, and hundreds digits.
- var Rem8 = Num3 % 8;
- var Rem4 = Math.floor(Rem8 / 2);
- var Rem2 = Rem8 % 2;
- var Rem5 = Num3 % 5;
- var Rem3 = Num3 % 3; // Note that Rem2, Rem3, Rem4, and Rem5 are mathematically independent.
- var RemT = Math.floor(Num3 / 120); // This is between 0 and 8
- // The idea is to begin with an array containing a single number, 0.
- // Each number 1 through 4 is added in a random spot in the array's current size.
- // The result - the numbers 0 to 4 are in the array in a random (and uniform) order.
- var Table5 = [0];
- Table5.splice(Rem2, 0, 1);
- Table5.splice(Rem3, 0, 2);
- Table5.splice(Rem4, 0, 3);
- Table5.splice(Rem5, 0, 4);
- Num3 = Math.floor(SEED / 1000); // Table1 will use the next 3 digits.
- Num3 = Num3 % 1000;
- Rem8 = Num3 % 8;
- Rem4 = Math.floor(Rem8 / 2);
- Rem2 = Rem8 % 2;
- Rem5 = Num3 % 5;
- Rem3 = Num3 % 3;
- RemT = RemT * 8 + Math.floor(Num3 / 120); // This is between 0 and 64.
- var Table1 = [0];
- Table1.splice(Rem2, 0, 1);
- Table1.splice(Rem3, 0, 2);
- Table1.splice(Rem4, 0, 3);
- Table1.splice(Rem5, 0, 4);
- i--;
- RemT = RemT % 5; // Between 0 and 4, fairly uniformly.
- x = (i + RemT) % 5; // RemT is horizontal shift to put any diagonal on the main diagonal.
- y = Math.floor(i / 5);
- // The Tables are set into a single magic square template
- // Some are the same up to some rotation, reflection, or row permutation.
- // However, all genuinely different magic squares can arise in this fashion.
- var e5 = Table5[(x + 3 * y) % 5];
- var e1 = Table1[(3 * x + y) % 5];
- // Table5 controls the 5* part and Table1 controls the 1* part.
- value = 5 * e5 + e1;
- if (MODE == "short") { value = Math.floor(value / 2); } // if short mode, limit difficulty
- else if (MODE == "long") { value = Math.floor((value + 25) / 2); }
- value++;
- return value;
- }
- function checkLine(i, typesA) {
- var synergy = 0;
- for (var j = 0; j < lineCheckList[i].length; j++) {
- var typesB = bingoBoard[lineCheckList[i][j] + 1].types;
- if (typeof typesB != 'undefined') {
- for (var k = 0; k < typesA.length; k++) {
- for (var l = 0; l < typesB.length; l++) {
- if (typesA[k] == typesB[l]) {
- synergy++; // if match increase
- if (k == 0) { synergy++ }; // if main type increase
- if (l == 0) { synergy++ }; // if main type increase
- }
- }
- }
- }
- }
- return synergy;
- }
- var bingoBoard = []; //the board itself stored as an array first
- for (var i = 1; i <= 25; i++) {
- bingoBoard[i] = { difficulty: difficulty(i) }; //array with objects that
- //console.log(bingoBoard[i].difficulty); //store the difficulty
- } // in order 1-25
- var totalWeight = 0;
- //populate the bingo board in the array
- for (var i = 1; i <= 25; i++) {
- var getDifficulty = bingoBoard[i].difficulty; // difficulty of current square
- var RNG = Math.floor(bingoList[getDifficulty].length * Math.random());
- if (RNG == bingoList[getDifficulty].length) { RNG--; }; //fix a miracle
- var j = 0, synergy = 0, currentObj = null, minSynObj = null;
- do {
- currentObj = bingoList[getDifficulty][(j + RNG) % bingoList[getDifficulty].length];
- synergy = checkLine(i, currentObj.types);
- if (minSynObj == null || synergy < minSynObj.synergy) {
- minSynObj = { synergy: synergy, value: currentObj };
- }
- j++;
- } while ((synergy != 0) && (j < bingoList[getDifficulty].length));
- bingoBoard[i].types = minSynObj.value.types;
- bingoBoard[i].name = minSynObj.value[LANG] || minSynObj.value.name;
- bingoBoard[i].synergy = minSynObj.synergy;
- totalWeight += minSynObj.value.weight;
- }
- return totalWeight;
- }
- } // setup
- var seedArray = []
- for (var i = 1; i <= 100000; i++ ) {
- var seed = i;
- var value = bingo(i);
- seedArray.push({ seed: seed, value: value });
- }
- function custom_compare (a,b) {
- return a.value - b.value;
- }
- seedArray.sort(custom_compare);
- var out = ""
- for(var i = 0; i < 20; i++) {
- out += seedArray[i].seed;
- out += ", ";
- }
- console.log(out);
Advertisement
Add Comment
Please, Sign In to add comment