Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Robocode by
Diff: source/Movement.cpp
- Revision:
- 54:453f24775644
- Parent:
- 52:56399c2f13cd
- Child:
- 55:36c290715769
--- a/source/Movement.cpp Tue Apr 18 11:50:02 2017 +0000
+++ b/source/Movement.cpp Tue Apr 18 13:11:55 2017 +0000
@@ -34,7 +34,7 @@
{
float current_heading = get_current_heading();
- position current_position = get_current_pos();
+ position current_pos = get_current_pos();
position next_pos = get_next_pos();
float needed_heading = 0;
@@ -43,24 +43,24 @@
// nord(-y) = 0 grad
if(current_pos.y > next_pos.y){
if(current_pos.x > next_pos.x) needed_heading = 315; distance = sqrt2;
- if(current_pos.x = next_pos.x) needed_heading = 0; distance = 1;
+ if(current_pos.x == next_pos.x) needed_heading = 0; distance = 1;
if(current_pos.x < next_pos.x) needed_heading = 45; distance = sqrt2;
}
- if(current_pos.y = next_pos.y){
+ if(current_pos.y == next_pos.y){
if(current_pos.x > next_pos.x) needed_heading = 270; distance = 1;
- if(current_pos.x = next_pos.x) //error same position;
+ if(current_pos.x == next_pos.x) //error same position;
if(current_pos.x < next_pos.x) needed_heading = 90; distance = 1;
}
if(current_pos.y < next_pos.y){
if(current_pos.x > next_pos.x) needed_heading = 225; distance = sqrt2;
- if(current_pos.x = next_pos.x) needed_heading = 180; distance = 1;
+ if(current_pos.x == next_pos.x) needed_heading = 180; distance = 1;
if(current_pos.x < next_pos.x) needed_heading = 135; distance = sqrt2;
}
if(needed_heading != current_heading) {
- turn_for_deg(needed_heading-current_heading);
+ turn_for_deg((needed_heading-current_heading));
} else {
- move_forard_for_distance(distance);
+ move_forward_for_distance(distance);
}
return 0;
}
