Moved loads of stuff
This commit is contained in:
19
src/blocks/util/coPrime.js
Normal file
19
src/blocks/util/coPrime.js
Normal file
@ -0,0 +1,19 @@
|
||||
function getFactors(num){
|
||||
factors = [];
|
||||
for(var i = 2; i <= num; i++){
|
||||
if(num%i == 0){
|
||||
factors.push(i);
|
||||
}
|
||||
}
|
||||
return factors;
|
||||
}
|
||||
|
||||
function coPrime(a, b){
|
||||
aFactors = getFactors(a);
|
||||
bFactors = getFactors(b);
|
||||
common = aFactors.filter((factor)=>(bFactors.indexOf(factor) > -1));
|
||||
|
||||
return (common.length == 0);
|
||||
}
|
||||
|
||||
module.exports = coPrime;
|
120
src/blocks/util/elements.js
Normal file
120
src/blocks/util/elements.js
Normal file
@ -0,0 +1,120 @@
|
||||
module.exports =[
|
||||
"h",
|
||||
"he",
|
||||
"li",
|
||||
"be",
|
||||
"b",
|
||||
"c",
|
||||
"n",
|
||||
"o",
|
||||
"f",
|
||||
"ne",
|
||||
"na",
|
||||
"mg",
|
||||
"al",
|
||||
"si",
|
||||
"p",
|
||||
"s",
|
||||
"cl",
|
||||
"ar",
|
||||
"k",
|
||||
"ca",
|
||||
"sc",
|
||||
"ti",
|
||||
"v",
|
||||
"cr",
|
||||
"mn",
|
||||
"fe",
|
||||
"co",
|
||||
"ni",
|
||||
"cu",
|
||||
"zn",
|
||||
"ga",
|
||||
"ge",
|
||||
"as",
|
||||
"se",
|
||||
"br",
|
||||
"kr",
|
||||
"rb",
|
||||
"sr",
|
||||
"y",
|
||||
"zr",
|
||||
"nb",
|
||||
"mo",
|
||||
"tc",
|
||||
"ru",
|
||||
"rh",
|
||||
"pd",
|
||||
"ag",
|
||||
"cd",
|
||||
"in",
|
||||
"sn",
|
||||
"sb",
|
||||
"te",
|
||||
"i",
|
||||
"xe",
|
||||
"cs",
|
||||
"ba",
|
||||
"la",
|
||||
"ce",
|
||||
"pr",
|
||||
"nd",
|
||||
"pm",
|
||||
"sm",
|
||||
"eu",
|
||||
"gd",
|
||||
"tb",
|
||||
"dy",
|
||||
"ho",
|
||||
"er",
|
||||
"tm",
|
||||
"yb",
|
||||
"lu",
|
||||
"hf",
|
||||
"ta",
|
||||
"w",
|
||||
"re",
|
||||
"os",
|
||||
"ir",
|
||||
"pt",
|
||||
"au",
|
||||
"hg",
|
||||
"tl",
|
||||
"pb",
|
||||
"bi",
|
||||
"po",
|
||||
"at",
|
||||
"rn",
|
||||
"fr",
|
||||
"ra",
|
||||
"ac",
|
||||
"th",
|
||||
"pa",
|
||||
"u",
|
||||
"np",
|
||||
"pu",
|
||||
"am",
|
||||
"cm",
|
||||
"bk",
|
||||
"cf",
|
||||
"es",
|
||||
"fm",
|
||||
"md",
|
||||
"no",
|
||||
"lr",
|
||||
"rf",
|
||||
"db",
|
||||
"sg",
|
||||
"bh",
|
||||
"hs",
|
||||
"mt",
|
||||
"ds",
|
||||
"rg",
|
||||
"cn",
|
||||
"nh",
|
||||
"fl",
|
||||
"mc",
|
||||
"lv",
|
||||
"ts",
|
||||
"og"
|
||||
];
|
8
src/blocks/util/toChar.js
Normal file
8
src/blocks/util/toChar.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = function(num){
|
||||
if(Number.isInteger(num)){
|
||||
return String.fromCharCode(num + 97);
|
||||
}
|
||||
else{
|
||||
return num;
|
||||
}
|
||||
}
|
9
src/blocks/util/toNum.js
Normal file
9
src/blocks/util/toNum.js
Normal file
@ -0,0 +1,9 @@
|
||||
module.exports = function(char){
|
||||
var num = char.toLowerCase().charCodeAt(0) - 97;
|
||||
if((num >= 0) && (num < 26)){
|
||||
return num;
|
||||
}
|
||||
else{
|
||||
return char;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user