Skip to main content
Code Review

Return to Question

Notice removed Reward existing answer by alecxe
Bounty Ended with Roland Illig's answer chosen by alecxe
Notice added Reward existing answer by alecxe
Bounty Started worth 100 reputation by alecxe
added 263 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

(theThe green light on the right is the traffic light)

Now, as far as coding goes, I've created a simple Car class with "forward"forward, "backward"backward, "forward_left"forward_left, "forward_right"forward_right, "backward_left"backward_left and "backward_right"backward_right actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

The code:

I would also appreciate any points about the code organization and quality since the next step would be to control the car "via bluetooth"Bluetooth".

(the green light on the right is the traffic light)

Now, as far as coding goes, I've created a simple Car class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

The code:

I would also appreciate any points about the code organization and quality since the next step would be to control the car "via bluetooth".

(The green light on the right is the traffic light)

Now, as far as coding goes, I've created a simple Car class with forward, backward, forward_left, forward_right, backward_left and backward_right actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

I would also appreciate any points about the code organization and quality since the next step would be to control the car "via Bluetooth".

Tweeted twitter.com/StackCodeReview/status/938320062158725120
added 66 characters in body
Source Link
alecxe
  • 17.5k
  • 8
  • 52
  • 93

(the green light on the right is the traffic light)

Now, as far as coding goes, I've created a simple Car class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

Now, as far as coding goes, I've created a simple Car class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

(the green light on the right is the traffic light)

Now, as far as coding goes, I've created a simple Car class with "forward", "backward", "forward_left", "forward_right", "backward_left" and "backward_right" actions. For the demonstration purposes mostly, I've tried to be explicit and violated the DRY principle a lot.

added 27 characters in body
Source Link
Phrancis
  • 20.5k
  • 6
  • 69
  • 155

I've also initialized an endless loop listening for keyboard inputs - fF would be for forward, bB for backwards and sS for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

I've also initialized an endless loop listening for keyboard inputs - f would be for forward, b for backwards and s for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

I've also initialized an endless loop listening for keyboard inputs - F would be for forward, B for backwards and S for stop (have not decided which keys would go for those "left-ish" and "right-ish" actions yet).

Source Link
alecxe
  • 17.5k
  • 8
  • 52
  • 93
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /