M
M
Maxim2020-10-12 11:55:36
Programming
Maxim, 2020-10-12 11:55:36

How to correctly understand whether a cell in chess is 1 bit or 13 bit?

Greetings!
The question is more for my understanding of the essence of things, and not for solving a specific problem.

1 question:
If a cell of a chess field can store 13 possible states (12 different figures + no figure), described by one unique symbol (let's say in hexadecimal number system), then how to correctly describe this cell? What is "In this cell is stored 1 bit of information"?
And how can you describe in the language of computer science that there are 13 different options available in a given cell?
I just don’t understand how to correctly name this fact in words (the number of possible options).

Question 2:
And if we also want to store information about the color of the cell, then:
The color of the cell should be an additional bit of information (that is, 2 bits of information will be stored in the cell). Or is it the multiplication of all variants of the state of the cell by 2?
That is, the cell still stores 1-bit information, and there are 26 possible options.
Or are both options possible?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2020-10-12
@max_shane

A bit is the smallest unit of information. It has two states, on/off, true/false, black/white, 0/1, etc.
It takes ⌈log 2 N⌉ bits to encode N different states.
So 13 cell states would require ⌈log 2 13⌉ = 4 bits.
The color of a cell can be obtained from its position on the board, and no separate bit is required for storage.

D
Developer, 2020-11-07
@samodum

In the case of a chessboard, there is no need to store 13 states for each cell, because it can contain only one figure. It is enough to designate through 0-empty, 1-pawn, 2-rook, 3-knight, etc. There are 6+1 different shapes in total (empty), that's 3 bits plus one bit per shape color. Total 4 bits for a cell.
The color of the cell also does not need to be stored as a state. It can be determined by cell coordinates (x,y). It is enough to add x + y and check this sum for evenness. If even, then a white cell, otherwise - black

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question