; random_walker — attacks adjacent enemies, otherwise splits or wanders at random. lea r8, [rdi + VIEW_CELLS] cmp byte [r8 + 7], CELL_ENEMY je .atk_up cmp byte [r8 + 13], CELL_ENEMY je .atk_right cmp byte [r8 + 17], CELL_ENEMY je .atk_down cmp byte [r8 + 11], CELL_ENEMY je .atk_left movzx eax, byte [rdi + VIEW_RAND] mov cl, al and cl, ACT_DIR_MASK ; random direction cmp rsi, SPLIT_MIN + 4 jb .maybe_move cmp al, 160 ; ~62%: split when able jae .maybe_move mov al, ACT_SPLIT or al, cl ret .maybe_move: cmp al, 96 ; ~37%: move jae .rest cmp rsi, 10 ; don't walk ourselves to death jb .rest mov al, ACT_MOVE or al, cl ret .rest: mov al, ACT_REST ret .atk_up: mov al, ACT_ATTACK + DIR_UP ret .atk_right: mov al, ACT_ATTACK + DIR_RIGHT ret .atk_down: mov al, ACT_ATTACK + DIR_DOWN ret .atk_left: mov al, ACT_ATTACK + DIR_LEFT ret