Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wallBuilder(input) {
- let base = [];
- let middle = [];
- let top = [];
- let separator = input.length / 3;
- for (let index in input) {
- if ((Number(index) + 1) / separator <= 1) {
- base.push(input[index]);
- } else if ((Number(index) + 1) / separator <= 2) {
- middle.push(input[index]);
- } else if ((Number(index) + 1) / separator <= 3) {
- top.push(input[index]);
- }
- }
- checkerBase(base);
- checkerMiddle(middle)
- checkerTop(top)
- function checkerBase(base) {
- let pattern = /\b[A-Z]{1,}[0-9]{4,}?([A-Z]{1,}[0-9]{4,})*\b/g;
- base.forEach(element => {
- if (element.match(pattern)) {
- console.log('SOLID BASE!');
- } else {
- console.log('WEAK BASE!');
- }
- });
- }
- function checkerMiddle(middle) {
- middle.forEach(element => {
- let isSolidMiddle = true;
- for (let index = 0; index < element.length; index++) {
- if ((0 <= index && index <= 2) &&
- ((element[index] < 'A' || ('Z' < element[index] && element[index] < 'a') || 'z' < element[index]))) {
- isSolidMiddle = false;
- break;
- } else if ((index > 2 && index < element.length - 2) &&
- (element[index] <= '"' || ('&' <= element[index] && element[index] <= '?') ||
- ('[' <= element[index] && element[index] <= '`') || '{' <= element[index])) {
- isSolidMiddle = false;
- console.log(element.charCodeAt(index));
- console.log(index);
- break;
- } else if ((index === element.length - 1) &&
- (element[index] <= '"' || ('%' <= element[index] && element[index] !== '@'))) {
- isSolidMiddle = false;
- break;
- }
- }
- if (isSolidMiddle) {
- console.log('SOLID MIDDLE!');
- } else {
- console.log('WEAK MIDDLE!');
- }
- });
- }
- function checkerTop(top) {
- let pattern = /\b0+([a-z]{0,5}[0])+\1+[a-z]{1,5}\b/g;
- top.forEach(element => {
- if (element.match(pattern)) {
- console.log('SOLID TOP!');
- } else {
- console.log('WEAK TOP!');
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment