# Chess Square Color

Здравейте, в Джъдж получавам само 20/100, а локално всичко работи както трябва.

Write a program that determines the color of a chessboard square based on its Label and Rank

• Labels have values from `a` to `h`
• Ranks have values from `1` to `8`

## Input

• On the first line, you will receive L - the label
• On the second line, you will receive R - the rank

## Output

• On the only line of output, print `light` or `dark` , based on your calculations

## Constraints

• `a` <= L <= `h`
• `1` <= R <= `8`

## Input

``````a
1
``````

## Output

``````dark
``````

## Input

``````f
3
``````

## Output

``````light
``````

Може ли да ми помогнете да открия проблема, ето го и решението:

``````const getGets = (arr) => {
let index = 0;

return () => {

const toReturn = arr[index];

index += 1;

};

};

const test = [

'g',

1,

];

const gets = this.gets || getGets(test);

let print = this.print || console.log;

let label = gets();

let rank = gets();

let labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];

let ranks = [1, 2, 3, 4, 5, 6, 7, 8];

let labelId = labels.indexOf(label.toLowerCase());

let rankId = ranks.indexOf(rank);

if (labelId % 2 == 0) {

if (rankId % 2 == 0) print('dark');

else print('light');

} else if (labelId % 2 == 1) {

if (rankId % 2 == 0) print('light');

else print('dark');
}
``````

Като ги промениш по този начин :
if (labelId % 2 == 0) {

``````if (rankId % 2 == 0) print('light');

else print('dark');
``````

} else if (labelId % 2 == 1) {

``````if (rankId % 2 == 0) print('dark');

else print('light');
``````

}
Станаха 80 точки.

Language: JavaScript

Points: 80

Time: 0.009 s

Memory: 8.50 MB

Date: 10/05/2022 21:50

Test cases

Test case #1: Accepted [0.009 s, 8.50 MB]

Test case #2: Accepted [0.009 s, 8.50 MB]

Test case #3: Wrong Answer [0.008 s, 8.50 MB]

Test case #4: Accepted [0.009 s, 8.50 MB]

Test case #5: Accepted [0.009 s, 8.50 MB]

Разгледай chess - Pastebin.com

Благодаря, махнах масива ranks и променливата rankId и вместо това директно направих проверка дали rank % 2 == 0 и мина със 100/100.