You know those great ideas that come up at the spur of the moment? They just go in here.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
codestash/combos2.js

110 lines
139 KiB

3 years ago
const FIRE=0;
const WATER=1;
const LIGHT=2;
const DARK=3;
const EARTH=4;
const ELECTRIC=5;
const WIND=6;
const ICE=7;
versatile=[[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,WATER,WIND,ICE],[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,WATER,ICE,WIND],[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,WIND,WATER,ICE],[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,WIND,ICE,WATER],[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,ICE,WATER,WIND],[FIRE,DARK,WIND,EARTH,ELECTRIC,ICE,ICE,WIND,WATER],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,WATER,WIND,ICE],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,WATER,ICE,WIND],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,WIND,WATER,ICE],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,WIND,ICE,WATER],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,ICE,WATER,WIND],[FIRE,DARK,WIND,EARTH,ICE,ELECTRIC,ICE,WIND,WATER],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,WATER,WIND,ICE],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,WATER,ICE,WIND],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,WIND,WATER,ICE],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,WIND,ICE,WATER],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,ICE,WATER,WIND],[FIRE,DARK,WIND,ELECTRIC,EARTH,ICE,ICE,WIND,WATER],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,WATER,WIND,ICE],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,WATER,ICE,WIND],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,WIND,WATER,ICE],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,WIND,ICE,WATER],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,ICE,WATER,WIND],[FIRE,DARK,WIND,ELECTRIC,ICE,EARTH,ICE,WIND,WATER],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,WATER,WIND,ICE],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,WATER,ICE,WIND],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,WIND,WATER,ICE],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,WIND,ICE,WATER],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,ICE,WATER,WIND],[FIRE,DARK,WIND,ICE,EARTH,ELECTRIC,ICE,WIND,WATER],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,WATER,WIND,ICE],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,WATER,ICE,WIND],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,WIND,WATER,ICE],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,WIND,ICE,WATER],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,ICE,WATER,WIND],[FIRE,DARK,WIND,ICE,ELECTRIC,EARTH,ICE,WIND,WATER],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,WATER,WIND,ICE],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,WATER,ICE,WIND],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,WIND,WATER,ICE],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,WIND,ICE,WATER],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,ICE,WATER,WIND],[FIRE,WIND,DARK,EARTH,ELECTRIC,ICE,ICE,WIND,WATER],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,WATER,WIND,ICE],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,WATER,ICE,WIND],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,WIND,WATER,ICE],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,WIND,ICE,WATER],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,ICE,WATER,WIND],[FIRE,WIND,DARK,EARTH,ICE,ELECTRIC,ICE,WIND,WATER],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,WATER,WIND,ICE],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,WATER,ICE,WIND],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,WIND,WATER,ICE],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,WIND,ICE,WATER],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,ICE,WATER,WIND],[FIRE,WIND,DARK,ELECTRIC,EARTH,ICE,ICE,WIND,WATER],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,WATER,WIND,ICE],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,WATER,ICE,WIND],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,WIND,WATER,ICE],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,WIND,ICE,WATER],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,ICE,WATER,WIND],[FIRE,WIND,DARK,ELECTRIC,ICE,EARTH,ICE,WIND,WATER],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,WATER,WIND,ICE],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,WATER,ICE,WIND],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,WIND,WATER,ICE],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,WIND,ICE,WATER],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,ICE,WATER,WIND],[FIRE,WIND,DARK,ICE,EARTH,ELECTRIC,ICE,WIND,WATER],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,WATER,WIND,ICE],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,WATER,ICE,WIND],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,WIND,WATER,ICE],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,WIND,ICE,WATER],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,ICE,WATER,WIND],[FIRE,WIND,DARK,ICE,ELECTRIC,EARTH,ICE,WIND,WATER],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,EARTH,WIND,ICE],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,EARTH,ICE,WIND],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,WIND,EARTH,ICE],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,WIND,ICE,EARTH],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,ICE,EARTH,WIND],[FIRE,WIND,ICE,WATER,EARTH,ELECTRIC,ICE,WIND,EARTH],[FIRE,WIND,ICE,WATER,ELECTRIC,EARTH,EARTH,WIND,ICE],[FIRE,WIND,ICE,WATER,ELECTRIC,EARTH,EARTH,ICE,WI
var prettyNames={
0:"FIRE",
1:"WATER",
2:"LIGHT",
3:"DARK",
4:"EARTH",
5:"ELECTRIC",
6:"WIND",
7:"ICE"
}
function GetCommonName(val) {
return prettyNames[val]
}
function PrettyList(arr) {
var finalArr=[]
for (var a of arr) {
var prettyStr=""
for (var i=0;i<a.length;i++) {
prettyStr+=((i!=0)?",":"")+GetCommonName(a[i]);
}
finalArr.push(prettyStr)
}
return finalArr
}
var combos=[
[FIRE,FIRE,FIRE],
[FIRE,WATER,FIRE],
[LIGHT,ELECTRIC,FIRE],
[WATER,WATER,WATER],
[ELECTRIC,ELECTRIC,WATER],
[LIGHT,LIGHT,WATER],
[FIRE,FIRE,LIGHT],
[LIGHT,LIGHT,LIGHT],
[WATER,WATER,DARK],
[ICE,ICE,DARK],
[DARK,DARK,DARK],
[WIND,WIND,EARTH],
[EARTH,FIRE,EARTH],
[ICE,ICE,EARTH],
[DARK,DARK,EARTH],
[EARTH,EARTH,ELECTRIC],
[WIND,WIND,ELECTRIC],
[DARK,LIGHT,ELECTRIC],
[WATER,EARTH,WIND],
[EARTH,FIRE,WIND],
[ICE,WATER,WIND],
[ELECTRIC,FIRE,WIND],
[FIRE,WATER,ICE],
[ELECTRIC,FIRE,ICE],
[WIND,ICE,ICE],
]
//console.log(versatile)
var maxcombo=0
var maxlist=[]
for (var vcombo of versatile) {
//console.log(JSON.stringify([driver1,driver2,driver3]))
var finalcombos={}
for (var combo of combos) {
if (!(prettyNames[combo[2]] in finalcombos)) {
var driver1=[vcombo[0],vcombo[1],vcombo[2]]
var driver2=[vcombo[3],vcombo[4],vcombo[5]]
var driver3=[vcombo[6],vcombo[7],vcombo[8]]
var matches=0;
for (var ind=0;ind<3;ind++) {
if (driver1.includes(combo[ind])) {
matches++;
driver1=[]
} else
if (driver2.includes(combo[ind])) {
matches++;
driver2=[]
} else
if (driver3.includes(combo[ind])) {
matches++;
driver3=[]
}
}
if (matches==3) {
finalcombos[prettyNames[combo[2]]]=true
}
}
}
if (Object.keys(finalcombos).length>maxcombo) {
maxcombo=Object.keys(finalcombos).length
maxlist=[{drivers:vcombo.map((ele)=>GetCommonName(ele)),combos:finalcombos}]
} else
if (Object.keys(finalcombos).length==maxcombo) {
maxlist.push({drivers:vcombo.map((ele)=>GetCommonName(ele)),combos:finalcombos})
}
//console.log(JSON.stringify(finalcombos))
}
console.log(JSON.stringify({maxendingcombo:maxcombo,count:maxlist.length,list:maxlist}))