Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function x(input) {
- let k = input[0];
- let l = input[1];
- let m = input[2];
- let n = input[3];
- let counterValid = 0;
- for (i = k; i <= 8 && counterValid != 6; i++) {
- if (i % 2 != 0) {
- continue;
- }
- for (j = 9; j >= l && counterValid != 6; j--) {
- if (j % 2 == 0) {
- continue;
- }
- let sum = Number(i + `${j} `);
- for (y = m; y <= 8 && counterValid != 6; y++) {
- if (y % 2 != 0) {
- continue;
- }
- for (z = 9; z >= n; z--) {
- if (z % 2 == 0) {
- continue;
- }
- let sum2 = Number(y + `${z} `);
- if (sum == sum2) {
- console.log(`Cannot change the same player.`);
- } else {
- counterValid++;
- console.log(`${sum} - ${sum2}`);
- if(counterValid == 6){
- break
- }
- }
- }
- }
- }
- }
- }
- x(["6", "7", "5", "6"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement