code: def _state_after_transition(self, current_state: int, target_state: int) -> int:
          
          return current_state + (current_state < target_state) - (current_state > target_state)
docs: Return the state reachable after a transition.
          Since the state for a gene can only change by 1, if the absolute value of the
          difference current_state - target_state is greater than 1, we lower it to 1 or -1.
          
          Examples
          --------
  
          >>> model._state_after_transition(0, 2)
          1  # Because 2 is too far from 0, the gene can only reach 1.
          >>> model._state_after_transition(1, 5)
          2  # 5 is still is too far from 1, so the gene can only reach 2.
          >>> model._state_after_transition(2, 1)
          1  # No problem here, 1 is at distance 1 from 2
          >>> model._state_after_transition(1, 1)
          1  # The state does not change here