As a chess enthusiast, you would like to write your own version of the game. Yes, there maybe plenty of implementations of chess available online already, but yours will be unique!
But before you can let your imagination run wild, you need to take care of the basics. Let's start by generating the board.
Each square of the chessboard is identified by a letter-number pair. The vertical columns of squares, called files, are labeled A through H. The horizontal rows of squares, called ranks, are numbered 1 to 8.
Implement the rank_range() function. It should return a range of integers, from 1 to 8.
julia> rank_range()
# output omittedImplement the file_range() function.
It should return a range of characters, from the uppercase letter A, to the uppercase letter H.
julia> file_range()
# output omittedImplement the ranks() function. It should return a vector of integers, from 1 to 8.
Do not write the vector by hand, generate it from the range returned by the rank_range() function.
julia> ranks()
[1, 2, 3, 4, 5, 6, 7, 8]Implement the files function. It should return a vector of characters, from 'A' to 'H'.
Do not write the vector by hand, generate it from the range returned by the file_range() function.
julia> files()
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']As a chess enthusiast, you would like to write your own version of the game. Yes, there maybe plenty of implementations of chess available online already, but yours will be unique!
But before you can let your imagination run wild, you need to take care of the basics. Let's start by generating the board.
Each square of the chessboard is identified by a letter-number pair. The vertical columns of squares, called files, are labeled A through H. The horizontal rows of squares, called ranks, are numbered 1 to 8.
Implement the rank_range() function. It should return a range of integers, from 1 to 8.
julia> rank_range()
# output omittedImplement the file_range() function.
It should return a range of characters, from the uppercase letter A, to the uppercase letter H.
julia> file_range()
# output omittedImplement the ranks() function. It should return a vector of integers, from 1 to 8.
Do not write the vector by hand, generate it from the range returned by the rank_range() function.
julia> ranks()
[1, 2, 3, 4, 5, 6, 7, 8]Implement the files function. It should return a vector of characters, from 'A' to 'H'.
Do not write the vector by hand, generate it from the range returned by the file_range() function.
julia> files()
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']