Skip to main content

encode_action

Function encode_action 

Source
pub fn encode_action(action: PlayerAction) -> [u8; 3]
Expand description

Pack an action for the wire: byte 0 is the cursor column, byte 1 the row, byte 2 is op (bits 0-1: 0 none, 1 place, 2 remove) and direction (bits 2-3, as Direction::id).

A byte per axis rather than the spec’s nibble, which capped online boards at 16 wide. The XL beach is 20.