Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const readline = require('readline');
  2. const rl = readline.createInterface({
  3.     input: process.stdin,
  4.     output: process.stdout
  5. });
  6.  
  7. function ham() {
  8.     rl.question('Nhap vi tri truc X ', function (A) {
  9.         rl.question('Nhap vi tri truc y ', function (B) {
  10.             $pass = 1 <= A <= 8 && 1 <= B <= 8;
  11.  
  12.             if (A == '' || B == '' || !$pass) {
  13.                 console.log('Vi tri sai');
  14.                 ham();
  15.                 return;
  16.             } else if ((A % 2 == 0 && B % 2 == 0) || A % 2 != 0 && B % 2 != 0) {
  17.                 console.log('Black');
  18.             } else {
  19.                 console.log('White')
  20.             }
  21.            
  22.             rl.close();
  23.         });
  24.     });
  25. }
  26.  
  27. ham();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement