Starting from an intitial sequence of ♥'s and ♠'s get to the goal sequence in a certain number of moves. To do this you can use 3 replacement rules, one at a time, on any consecutive substring of the present sequence. You never need more than 6 symbols. Below is a sample puzzle and its solution.

Rule #2: ♥♥♥ → ♠♠

Rule #3: ♠♥ → ♠

Goal: ♥♠♠ → ♠♥♥♠♠♠ in 5 moves

♥♠♠ → ♥♥♠♠ → ♥♥♥♠♠ → ♠♠♠♠ → ♠♥♠♠♠ → ♠♥♥♠♠♠

(Rule #1) (Rule #1) (Rule #2) (Rule #1) (Rule #1)

Each puzzle below has a unique solution.

Goal: ♥♥♠ → ♥♠♥♥♥♠ in 5 moves
Goal: ♠♠♥ → ♠♠♠♥♥♠ in 5 moves
Goal: ♥♥♠ → ♠♠♠♥♠♠ in 5 moves
Goal: ♥♥♥ → ♠♠♥♠♥ in 5 moves

Rule #1: ♠ → ♠♥

Rule #2: ♠♠♠ → ♥♠

Rule #3: ♥♥ → ♠♥♥

Rule #1: ♠ → ♠♥

Rule #2: ♥♥♥ → ♠♠

Rule #3: ♥♥ → ♠♠♠

Rule #1: ♥ → ♠♥♠

Rule #2: ♥♠♥ → ♥♠

Rule #3: ♠♥♠ → ♥

Rule #1: ♥ → ♠♥♠

Rule #2: ♠ → ♥♥♥

Rule #3: ♠♥♥ → ♠

Goal: ♥♠ → ♥♠♥♥♥♠ in 6 moves
Goal: ♠ → ♠♠♥♠♠ in 6 moves
Goal: ♥ → ♠♠♥ in 6 moves
Goal: ♥♥ → ♠♥♠♠♥ in 6 moves

Rule #1: ♥ → ♠♥

Rule #2: ♠ → ♠♥

Rule #3: ♠♥♥ → ♠♠

Rule #1: ♥♥♠ → ♥

Rule #2: ♠ → ♠♥♥

Rule #3: ♥♥ → ♠♠

Rule #1: ♥ → ♠♥♥

Rule #2: ♠♥♠ → ♠♠

Rule #3: ♠♥♥ → ♥

Rule #1: ♥♠ → ♠

Rule #2: ♥ → ♥♠♠

Rule #3: ♥ → ♥♥♠

Goal: ♥♠♥ → ♥♥♠♥♥ in 7 moves
Goal: ♠♥♥ → ♠♥♠♠♠♠ in 7 moves
Goal: ♥♥♠ → ♥♠♥♥♥ in 7 moves
Goal: ♥♠♥ → ♥♠♠♥♥♥ in 7 moves

Rule #1: ♥♠ → ♥

Rule #2: ♥♥→♥

Rule #3: ♠→♠♠♥

Rule #1: ♥♥ → ♥♠♠

Rule #2: ♠ → ♠♥♥

Rule #3: ♥♠♥ → ♥

Rule #1: ♥♥♠ → ♥

Rule #2: ♥ → ♠♠♠

Rule #3: ♠ → ♠♥♥

Rule #1: ♠ → ♥♠♠

Rule #2: ♥♠ → ♠♠♥

Rule #3: ♥♥♠ → ♥♥

Goal: ♠ → ♥♥♠♥♥ in 8 moves
Goal: ♥♥ →♠♠♠♠♠♥ in 8 moves
Goal: ♥♥♠ → ♥♠♥♠♥♥ in 8 moves
Goal: ♥♠ → ♠♠♥♠♠ in 8 moves

Rule #1: ♠ → ♥♥♥

Rule #2: ♠ → ♥♠♠

Rule #3: ♥♠ → ♥

Rule #1: ♠→♠♥♠

Rule #2: ♥♠♠→♠♥

Rule #3: ♥♥→♠♠♥

Rule #1: ♥ → ♠♠

Rule #2: ♥♥♠ → ♠♥

Rule #3: ♥♠♠ → ♥♠♥

Rule #1: ♥♠ → ♠

Rule #2: ♥ → ♥♥♠

Rule #3: ♥ → ♥♥

Goal: ♠♠♥ → ♥♥♠♥♥ in 9 moves
Goal: ♠♠♠ → ♠♥♠♥♥ in 9 moves
Goal: ♠♥ → ♠♥♠♠♠♠ in 9 moves
Goal: ♥♠ → ♠♥♥♥♥ in 9 moves

Rule #1: ♥♥♠ → ♥

Rule #2: ♠♠♥ → ♠♥

Rule #3: ♠ → ♥♠♠

Rule #1: ♠♠♠ → ♥

Rule #2: ♠♠♥ → ♥♠♠

Rule #3: ♥ → ♠♥♠

Rule #1: ♠ → ♥♥♥

Rule #2: ♥♠♥ → ♠♥

Rule #3: ♠♥ → ♥♠♠

Rule #1: ♥♠♠ → ♥♥

Rule #2: ♥ → ♠♥♥

Rule #3: ♥♠ → ♠♠

Goal: ♠♥ → ♥♠♥♥♠ in 10 moves
Goal: ♠♠ → ♥♥♠♥♠♠ in 10 moves
Goal: ♥♥ → ♠♥♥♥♠♠ in 10 moves
Goal: ♠♥♥ → ♥♠♠♠ in 10 moves

Rule #1: ♠ → ♥♥

Rule #2: ♠♥♠ → ♥

Rule #3: ♥♥♥ → ♠♥♠

Rule #1: ♠ → ♥♥♠

Rule #2: ♥♥♠ → ♥

Rule #3: ♠♥ → ♥♠♠

Rule #1: ♥♥♥ → ♠♠

Rule #2: ♠♠ → ♥♥♠

Rule #3: ♥♥ → ♠♠♠

Rule #1: ♥♠♠ → ♠

Rule #2: ♥♥♥ → ♠♥

Rule #3: ♠♥ → ♥♥♠

Goal: ♥♠ → ♠♠♥♠♥♠ in 11 moves
Goal: ♠♥♠ → ♠♥♥♠♥♠ in 11 moves
Goal: ♠♥ → ♥♥♥♥♠♥ in 11 moves
Goal: ♠♠♥ → ♥♥♥♥♠♠ in 11 moves

Rule #1: ♠♥ → ♥♥♥

Rule #2: ♠♥♥ → ♠♥

Rule #3: ♥ → ♠♠♥

Rule #1: ♥♠ → ♥

Rule #2: ♠ → ♥♥

Rule #3: ♥♥ → ♠♠♥

Rule #1: ♥♠♠ → ♥♠♥

Rule #2: ♠♥♠ → ♥

Rule #3: ♥ → ♥♠

Rule #1: ♥♠♠ → ♥♥

Rule #2: ♠♥ → ♥♠♠

Rule #3: ♠♥ → ♥

Goal: ♥♠♥ → ♠♠♥♥♠ in 12 moves
Goal: ♠♥ → ♥♥♠♥♥♥ in 12 moves
Goal: ♠♥♥ → ♥♥♠♠♠♥ in 12 moves
Goal: ♥ → ♠♠♠♠♠♠ in 12 moves

Rule #1: ♠ → ♠♠♥

Rule #2: ♥♠♠ → ♥♥

Rule #3: ♥♠♥ → ♠

Rule #1: ♠♠ → ♥♥♠

Rule #2: ♠♥ → ♠♠♠

Rule #3: ♥♥♠ → ♥♥

Rule #1: ♥♥♠ → ♥

Rule #2: ♠ → ♥♠

Rule #3: ♥ → ♠♥♠

Rule #1: ♥ → ♠♥♥

Rule #2: ♥♥ → ♠♠♠

Rule #3: ♠♥♠ → ♥

Goal: ♠♥♠ → ♠♠♠♥♥ in 13 moves
Goal: ♥♠♥ → ♥♠♠♥♠ in 13 moves
Goal: ♠♥♥ → ♥♠♠♥♠♥ in 13 moves
Goal: ♠♠♠ → ♠♥♠♠♥♥ in 13 moves

Rule #1: ♥♠♠ → ♠♥

Rule #2: ♠♥♥ → ♥♠♠

Rule #3: ♠ → ♥♠♠

Rule #1: ♠ → ♥♠♥

Rule #2: ♠♥ → ♥

Rule #3: ♥♥♥ → ♥♠

Rule #1: ♥♥ → ♠♥♠

Rule #2: ♠♥ → ♥♠♠

Rule #3: ♠♥♠ → ♥♥

Rule #1: ♠♠♠ → ♠♥

Rule #2: ♥ → ♠♠

Rule #3: ♠♥ → ♥♥♠

Goal: ♠♥ → ♥♥♠♥♠♠ in 14 moves
Goal: ♥ → ♥♥♥♠♥ in 14 moves
Goal: ♠♥ → ♠♠♥♥♥ in 14 moves
Goal: ♥ → ♥♠♠♠♠ in 14 moves

Rule #1: ♠♥ → ♥♠♥

Rule #2: ♥ → ♠♠♠

Rule #3: ♥♥♠ → ♥

Rule #1: ♠♠♥ → ♠♠

Rule #2: ♥ → ♠♥♠

Rule #3: ♠♠♠ → ♥♥♥

Rule #1: ♥♠♠ → ♠♥

Rule #2: ♥ → ♥♠♠

Rule #3: ♠♠♥ → ♥♥♠

Rule #1: ♥ → ♠♠♠

Rule #2: ♠♠♥ → ♠♥

Rule #3: ♠ → ♥♠♥

Goal: ♥♥♠ → ♠♠♥♠♥♠ in 15 moves
Goal: ♠♠♥ → ♠♠♠♥♥♥ in 15 moves
Goal: ♥♠ → ♠♥♠♥♠♥ in 15 moves
Goal: ♥♠♥ → ♥♠♠♥♠♥ in 15 moves

Rule #1: ♥♠ → ♥♠♥

Rule #2: ♥♥♠ → ♠

Rule #3: ♠♥♥ → ♠♠

Rule #1: ♠♥♠ → ♠♥

Rule #2: ♠ → ♥♥♠

Rule #3: ♥♠ → ♠♠

Rule #1: ♥♥♠ → ♠

Rule #2: ♠♠ → ♥♠♥

Rule #3: ♥ → ♠♠♥

Rule #1: ♠♥ → ♠♠

Rule #2: ♠♠ → ♥♠♠

Rule #3: ♥♥♠ → ♠♥

Goal: ♠ → ♠♥♥♠♠♠ in 16 moves
Goal: ♠♥♠ → ♥♥♥♥♥♠ in 16 moves
Goal: ♠ → ♠♠♠♥♥♠ in 16 moves
Goal: ♠♠ → ♥♠♥♥♥ in 16 moves

Rule #1: ♠ → ♥♥♥

Rule #2: ♥♠♥ → ♥♠

Rule #3: ♥ → ♠♥♥

Rule #1: ♠♥♥ → ♥♠

Rule #2: ♥ → ♠♠♠

Rule #3: ♠♠ → ♥♥♥

Rule #1: ♥ → ♥♥♠

Rule #2: ♥♠♥ → ♠♥

Rule #3: ♠ → ♥♥♥

Rule #1: ♥♥♠ → ♥

Rule #2: ♠♠ → ♥♠♥

Rule #3: ♥ → ♠♥♠

Goal: ♠♠♥ → ♠♠♥♥♥ in 17 moves
Goal: ♥♥ → ♠♥♠♠♠♠ in 17 moves
Goal: ♠♠ → ♥♥♥♥♠♥ in 17 moves
Goal: ♠♠ → ♠♥♠♠♠♥ in 17 moves

Rule #1: ♠♠♠ → ♥♠♥

Rule #2: ♥♥ → ♠

Rule #3: ♥ → ♠♠♥

Rule #1: ♠♥ → ♥♠♠

Rule #2: ♥♥♠ → ♥

Rule #3: ♥ → ♠♥♥

Rule #1: ♠♥ → ♥♥♠

Rule #2: ♥♠♠ → ♠

Rule #3: ♠ → ♠♠♥

Rule #1: ♥ → ♠♥♠

Rule #2: ♠♠ → ♥♥♥

Rule #3: ♠♥♥ → ♠♠

Goal: ♥♠ → ♥♠♥♥♠♥ in 18 moves
Goal: ♠♥ → ♥♠♠♠♥ in 18 moves
Goal: ♥♠ → ♠♠♠♠♥ in 18 moves
Goal: ♥♠ → ♥♥♥♠♥♠ in 18 moves

Rule #1: ♥♥ → ♠♠♥

Rule #2: ♥♠ → ♠♥♥

Rule #3: ♠♠♥ → ♥♠

Rule #1: ♥♠♥ → ♠♠

Rule #2: ♠ → ♥♠♠

Rule #3: ♠♠♠ → ♥♥

Rule #1: ♥ → ♥♥♠

Rule #2: ♥♥♥ → ♠♠

Rule #3: ♠♥♠ → ♥

Rule #1: ♠ → ♥♠♥

Rule #2: ♠♠♥ → ♠

Rule #3: ♥♥ → ♠♥♠

Goal: ♥♠♥ → ♥♥♠♠♥♠ in 19 moves
Goal: ♠♥♥ → ♥♥♠♠♥ in 19 moves

Rule #1: ♠♥♥ → ♠♠

Rule #2: ♥♠ → ♠♥♥

Rule #3: ♠ → ♥♥

Rule #1: ♥ → ♥♥♠

Rule #2: ♠♥♠ → ♥

Rule #3: ♠♥♥ → ♠♠

See the solutions.