diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-13 16:48:15 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-13 16:48:15 +0200 |
| commit | ea0d0dcbf4b23f9ed84300b9771ca3b2deab1a18 (patch) | |
| tree | 72c64ccf19f833a34ba77e0cdda56108712f35a7 /src/board/board.hpp | |
| parent | 58e30cce0c3cc0ed467def5b36d861fb68f146b1 (diff) | |
moving enum around
Diffstat (limited to 'src/board/board.hpp')
| -rw-r--r-- | src/board/board.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/board/board.hpp b/src/board/board.hpp index 6f72e56..35e2196 100644 --- a/src/board/board.hpp +++ b/src/board/board.hpp @@ -32,6 +32,42 @@ struct Position { bool operator==(const Position &) const = default; }; + +/* + * Maybe we can try to be efficent with memory by using a byte (char) or + * something like that let me brainstorm a little + * + * first two bits can be promotion flag because there are 4 posible options: + * NONE BISHOP ROOK QUEEN + * but wait none it not requided because its only applied + * when on last rank + * but that doesnt help becuase we cant have three options + * ok so first 2 bits for promotion flag + * like this ZZYYYYYY with ZZ being the promotion flag + * 00 for none piece + * 01 for queen + * 10 for rook + * 11 for bishop + * these valuesa are abritrari + * so we have other 6 bytes which doesnt work that well because we need to store + * two 64 bit numbers one for "From" and second for "To" + * so wait how much is a 64 for bit + * 2 * 2 = 4 (2 bits) + * 4 * 2 = 8 (3 bits) + * 8 * 2 = 16 (4 bits) + * 16 * 2 = 32 (5 bits) + * 32 * 2 = 64 (6 bits) + * so six bits that means that we can only store one posiiton we need a 2 + 6 * + * 2 (14) bits of value to represent it but wait when promotion flag isnt 0 we + * know its last rank oh but we dont know if from white or black perpective so + * 14 bits is required let me search if there is a way to store that data + * alright search done result seams that best way is to use 16 bit interger + * which look like good solution and we have 2 bits left if we want to add more + * things here is a diagram for it uint16_t: XXFFFFFFTTTTTT XX for promotion + * flag F for from position T for to position so we can try first writing a + * helper function for working with it then replace existing move struct + */ + struct Move { Position From; Position To; |
