Advertisement
remote87

Find light dark on chess board 1-8 A-H

Oct 19th, 2020
2,265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         String label = scanner.nextLine();
  11.         int ranks = Integer.parseInt(scanner.nextLine());
  12.  
  13.         label = label.toUpperCase();
  14.         char asciChar = label.charAt(0);
  15.  
  16.         if(asciChar % 2 == 1 && ranks % 2 == 1){
  17.             System.out.println("dark");
  18.         }else if(asciChar % 2 == 1 && ranks % 2 == 0){
  19.             System.out.println("light");
  20.         }else if(asciChar % 2 == 0 && ranks % 2 == 1){
  21.             System.out.println("light");
  22.         }else if(asciChar % 2 == 0 && ranks % 2 == 0){
  23.             System.out.println("dark");
  24.         }
  25.     }
  26. }
  27.  
  28.  
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement