Skip to content

Commit

Permalink
smartcab left turn
Browse files Browse the repository at this point in the history
  • Loading branch information
adarsh0806 committed Aug 9, 2017
1 parent 7081cb2 commit 912f9ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions projects/smartcab/smartcab/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,11 @@ def act(self, agent, action):
violation = 4 # Accident
elif inputs['oncoming'] == 'right': # Oncoming car turning right
violation = 4 # Accident
else: # Green light
heading = (heading[1], -heading[0]) # Valid move. We assume the cab will wait for the lane to be clear on a green light, before taking the left turn.
else:# Green light
if inputs['oncoming'] == 'right' or inputs['oncoming'] == 'forward': # Incoming traffic
violation = 3 # Accident
else: # Valid move!
heading = (heading[1], -heading[0])

# Agent wants to drive right:
elif action == 'right':
Expand Down

0 comments on commit 912f9ed

Please sign in to comment.