This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------- | |
# 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| |