21 lines
505 B
Ruby
21 lines
505 B
Ruby
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
|
|
|
# frozen_string_literal: true
|
|
|
|
module Tables
|
|
class WheelSwap
|
|
private attr_reader :initial_solution
|
|
def initialize(initial_solution)
|
|
@initial_solution = initial_solution
|
|
end
|
|
|
|
def call
|
|
new_solution = @initial_solution.deep_dup
|
|
|
|
selected_guests = new_solution.tables.map(&:pop).cycle.tap(&:next)
|
|
new_solution.tables.each { |table| table << selected_guests.next }
|
|
|
|
new_solution
|
|
end
|
|
end
|
|
end |