Created
May 24, 2019 07:32
-
-
Save alterisian/0e635349ec69acde666547b804387d2d to your computer and use it in GitHub Desktop.
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
class Car | |
attr_accessor driving_genome | |
#Car has_many driving_methods | |
#Car has_many driving_evaluation_methods | |
#Car has_many detection_methods | |
def initiliaze(param) | |
@driving_genome = param.to_a | |
end | |
def go | |
end | |
end | |
action_ | |
keep_moving_forward_at_current_speed | |
slow_down | |
speed_up | |
turn_left_a_bit | |
turn_right_a_bit | |
turn_left_a_lot | |
turn_right_a_lot | |
detect_ | |
how_far_from_the_side_of_the_track | |
evaluate_from_forward_facing_cameras | |
distance_to_left = detect_left_side | |
detect_right_side = detect_right_side | |
detect_distance_to_next_bend | |
# if more than next 5 'moves' maybe it doesn't matter. So 5*v = NO BEND. | |
detect_estimated_angle_of_bend | |
# look at far field of vision. Where is edge? far(x,y) | |
# look at near field of vision. Where is edge? near(x,y) | |
# do trig to evaluate angle between far(x,y) and near(x,y) | |
#distance_unit = mm | |
#speed_unit = mm/s | |
goal_distance_from_side = 100 | |
goal_speed = 100 | |
#Absolute_knowns. | |
CAR_LENGTH=600 | |
CAR_WIDTH=360 | |
TRACK_WIDTH = 1200 | |
#Dervived knowns | |
current_speed | |
maximum_speed | |
angle_of_steering | |
distance_from_left_of_track | |
distance_from_right_of_track | |
mutation can bring in method. | |
GAME: success_evaluation of car(x) | |
- stayed_on_the track | |
- moved_forward | |
- stayed_same_distance_from_side_of_road | |
- waited_at_any_track_line_crossings | |
- waited at any track line crossings, then continued. | |
Game.new | |
driving_genome = load_driving_genome | |
get_new_car(driving_genome) | |
add_car_to_track(start_position) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment