dino_game_v2.rb
# Predict/decide whether or not dinosaur should jump

Predict/decide whether or not dinosaur should jump
Predict / decide whether or not dinosaur should jump
def predict(input_0, input_1, input_2, dino)
	prediction = (input_0*dino.chromosome[0] + input_1*dino.chromosome[1] + (input_2/2)*dino.chromosome[2] + dino.chromosome[3])/(input_0 + input_1 + (input_2/2) + 1)
	if prediction > PREDICTION_THRESHOLD
		dino.try_to_jump
	end
end
def predict ( input_0 , input_1 , input_2 , dino ) prediction = ( input_0 * dino . chromosome [ 0 ] + input_1 * dino . chromosome [ 1 ] + ( input_2 / 2 ) * dino . chromosome [ 2 ] + dino . chromosome [ 3 ] ) / ( input_0 + input_1 + ( input_2 / 2 ) + 1 ) if prediction > PREDICTION_THRESHOLD dino . try_to_jump end end
Predict/decide whether or not dinosaur should jump
Predict / decide whether or not dinosaur should jump
#((Math.sqrt(input_0*input_0+input_1*input_1+(input_2/2)*(input_2/2)+1))*Math.sqrt((dino.chromosome[0]*dino.chromosome[0]+dino.chromosome[1]*dino.chromosome[1]+dino.chromosome[2]*dino.chromosome[2]+dino.chromosome[3]*dino.chromosome[3])))

input_0
<not_specific>
input_1
<not_specific>
input_2
<not_specific>
dino
<not_specific>