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
source/StartUp.cpp@63:87b615e4a842, 2017-04-19 (annotated)
- Committer:
- aeschsim
- Date:
- Wed Apr 19 08:59:53 2017 +0000
- Revision:
- 63:87b615e4a842
- Parent:
- 61:b57577b0072f
- Child:
- 69:1fdcef6a7577
Test Tool for Grabbing, endless loop
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cittecla | 38:3526c36e4c73 | 1 | #include "StartUp.h" |
| cittecla | 38:3526c36e4c73 | 2 | |
| cittecla | 61:b57577b0072f | 3 | bool stb = false; |
| cittecla | 61:b57577b0072f | 4 | bool stb2 = false; |
| cittecla | 61:b57577b0072f | 5 | bool stb3 = false; |
| cittecla | 38:3526c36e4c73 | 6 | |
| cittecla | 58:1a395b6928ee | 7 | int idel() |
| cittecla | 58:1a395b6928ee | 8 | { |
| cittecla | 61:b57577b0072f | 9 | |
| cittecla | 61:b57577b0072f | 10 | if(get_user() == false && stb) { |
| cittecla | 61:b57577b0072f | 11 | return 15; // button pressed |
| cittecla | 58:1a395b6928ee | 12 | } else { |
| cittecla | 61:b57577b0072f | 13 | stb = true; |
| cittecla | 58:1a395b6928ee | 14 | return 10; |
| cittecla | 38:3526c36e4c73 | 15 | } |
| cittecla | 58:1a395b6928ee | 16 | } |
| cittecla | 58:1a395b6928ee | 17 | |
| cittecla | 58:1a395b6928ee | 18 | int idel2() |
| cittecla | 58:1a395b6928ee | 19 | { |
| cittecla | 61:b57577b0072f | 20 | |
| cittecla | 61:b57577b0072f | 21 | if(get_user() == false && stb2) { |
| aeschsim | 63:87b615e4a842 | 22 | return 52; // button pressed |
| cittecla | 58:1a395b6928ee | 23 | } else { |
| cittecla | 61:b57577b0072f | 24 | stb2 = true; |
| cittecla | 61:b57577b0072f | 25 | wait_ms(100); |
| cittecla | 58:1a395b6928ee | 26 | return 11; |
| cittecla | 38:3526c36e4c73 | 27 | } |
| cittecla | 58:1a395b6928ee | 28 | } |
| cittecla | 38:3526c36e4c73 | 29 | |
| cittecla | 58:1a395b6928ee | 30 | |
| cittecla | 58:1a395b6928ee | 31 | int initialisation() |
| cittecla | 58:1a395b6928ee | 32 | { |
| cittecla | 58:1a395b6928ee | 33 | Robot_init_all(); |
| cittecla | 58:1a395b6928ee | 34 | return 16; |
| cittecla | 58:1a395b6928ee | 35 | } |
| cittecla | 58:1a395b6928ee | 36 | |
| cittecla | 58:1a395b6928ee | 37 | |
| cittecla | 58:1a395b6928ee | 38 | int inital_positioning() |
| cittecla | 58:1a395b6928ee | 39 | { |
| cittecla | 61:b57577b0072f | 40 | printf("positioning...\r\n"); |
| cittecla | 58:1a395b6928ee | 41 | return 11; |
| cittecla | 58:1a395b6928ee | 42 | } |
| cittecla | 58:1a395b6928ee | 43 | |
| cittecla | 58:1a395b6928ee | 44 | |
| cittecla | 58:1a395b6928ee | 45 | int initial_turn() |
| cittecla | 58:1a395b6928ee | 46 | { |
| cittecla | 61:b57577b0072f | 47 | |
| cittecla | 61:b57577b0072f | 48 | if(stb3 == false) { |
| cittecla | 61:b57577b0072f | 49 | stb3 = true; |
| cittecla | 61:b57577b0072f | 50 | printf("initial turn...\r\n"); |
| cittecla | 61:b57577b0072f | 51 | turn_for_deg(180); |
| cittecla | 61:b57577b0072f | 52 | } else { |
| cittecla | 61:b57577b0072f | 53 | printf("turning...\r\n"); |
| cittecla | 61:b57577b0072f | 54 | if(1) { // check if turning complete |
| cittecla | 61:b57577b0072f | 55 | printf("turn finished...\r\n"); |
| cittecla | 61:b57577b0072f | 56 | return 35; |
| cittecla | 61:b57577b0072f | 57 | } |
| cittecla | 61:b57577b0072f | 58 | } |
| cittecla | 61:b57577b0072f | 59 | return 27; |
| cittecla | 58:1a395b6928ee | 60 | } |
