Skip to content

Instantly share code, notes, and snippets.

@crossbone-magister
crossbone-magister / ff4hl-math-solver.rb
Last active August 4, 2019 15:56
Final Fantasy The Four Heroes of Light Math Minigame Solver
#--------------
# This code was written some time ago to solve the Math Minigame in the game Final Fantasy The Four Heroes of Light that allows the player to unlock the Beastmaster Crown.
# To use the script run 'ruby ff4hl-math-solver.rb <number1> <number2> <number3> <number4>'.
# The script will output the combination that awards the most points
#--------------
def find_best(operators,numbers)
all_operators_perm = operators.repeated_permutation(3).to_a
all_numbers_perm = numbers.permutation.to_a
res = []
all_numbers_perm.each do |num_quad|