Здравейте, в Джъдж получавам само 20/100, а локално всичко работи както трябва.
Write a program that determines the color of a chessboard square based on its Label and Rank
- Labels have values from
a
toh
- Ranks have values from
1
to8
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
ordark
, based on your calculationsConstraints
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;
return toReturn;
};
};
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');
}