# https://twitter.com/pickover/status/1504602497280786435
# Pickover puzzle: https://twitter.com/pickover/status/1504602497280786435
# (https://gpuzzles.com/mind-teasers/very-easy-number-sequence-puzzle/ )
# 
#  What number should replaced the question mark?
#     3         9       8
#    44        32      75
#  8    4    7   2    7  ? 
#
# Encoded as
#   a   b   c   d
#   3 x 8 x 3 = 44
#
# Here c is the unknown (index 2, 0-based)
#
# Solution:
#
#   d / (a + b) [1]
#   It was 1 different solutions with fitness 0.0
#
#   Testing the fittest program with user defined test data: 
#   8.0 7.0 75.0    Result: 5.0
#
# The answer is:
#  5 = 75 / (8-7)
#     8
#    75
#  7    5
#   
#
# Note: Setting d (output index 3) results in
#   (a * c) + (b * c)
# but calculating the ? variable is then not correct:
#   8.0 7.0 -1.0    Result: -15.0
# And this should be considered a bug.
#
# Another solution:
#  (9.0 / 9.0) + ((9.0 / a) ** (d / d))
# which simplifies to
#    1 + 9/a
# 8.0 7.0 75.0    Result: 2.125
#
# Yet another solution (not using d)
# ((b + a) - a) - ((12.0 - a) - (b - a))
# which simplifies to
#   -12. + 2 b
# 8.0 7.0 75.0    Result: 2.0
#
# And another:
# (68.0 - d) / (a + a)
# 8.0 7.0 75.0    Result: -0.4375
#
# And:
# (b + ((b + (((b * a) - a) + 51.0)) + b)) / (b * a)
# 8.0 7.0 75.0    Result: 2.142857142857143
#
# And:
# ((b + a) + ((b + a) / (b + (9.0 / a)))) / a
# 8.0 7.0 75.0    Result: 2.105769230769231
#
# And:
#  (d + (d + (d - 60.0))) / 18.0
# which simplifies to
#   0.0555556 (-60. + 3 d)
# 8.0 7.0 75.0    Result: 9.166666666666666
#
presentation: Pickover Puzzle 1
return_type:IntegerClass
num_input_variables: 3
# Index of output variable (0-based)
# c as output variable
output_variable:2
# d as output variable
# output_variable: 3
variable_names:a b c d
functions: Add,Multiply,Divide,Subtract,Pow
# functions: Add,Multiply
# functions: Add,Pow
# functions: ForLoopD
# functions: Add,ForLoopD
# functions: Add,ForXLoop,SubProgram
# functions: Add,LoopD
# functions: Multiply,Divide,Add,Subtract,Modulo,GreaterThan,LesserThan,IfElse,If,Equals,And,Or,Not,Xor
# functions: Add,Modulo,SubProgram,Tupel,Argument,StoreTerminal
# functions: Add,Modulo
# functions: Add,Multiply,SubProgram,Tupel,Argument,StoreTerminal
# functions: Multiply,Divide,Subtract,Modulo,GreaterThan,LesserThan,IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
# functions: Multiply,Divide,Add,Subtract,LoopD
# functions: Add,ForXLoop,ForLoop,Loop,SubProgram,Tupel,Argument,StoreTerminal
# functions: Add,GreaterThan,LesserThan,IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
# adf_arity: 3
# adf_type: integer
# adf_functions: Multiply,Add
# adf_functions: IfElse,If,Equals,ForXLoop,Increment,ForLoop,Loop,Pop,Push,And,Or,Not,Xor,SubProgram,Tupel,Argument,StoreTerminal
terminal_range: 1 100
terminal_wholenumbers: true
max_init_depth: 4
population_size: 100
max_crossover_depth: 8
num_evolutions: 1000
# max_nodes: 51
max_nodes: 21
mutation_prob: 0.15
crossover_prob: 0.9
# crossover_prob: 0.96
show_similiar: true
# show_population: true
show_results: true
stop_criteria_fitness: 0

data
# a b c d
# Note: c is the output variable
  3 8 4 44
  9 7 2 32
  8 7 ? 75