Learn R Programming

cayleyR (version 0.2.1)

breakpoint_distance: Breakpoint Distance Between Two States

Description

Counts the number of positions where consecutive elements differ by more than 1 (breakpoints). Particularly effective for TopSpin puzzles where operations shift blocks and flip prefixes.

Usage

breakpoint_distance(start_state, target_state)

Value

Integer, the number of breakpoints

Arguments

start_state

Integer vector, first state

target_state

Integer vector, second state

Examples

Run this code
breakpoint_distance(1:5, 5:1)
breakpoint_distance(1:5, 1:5)

Run the code above in your browser using DataLab