![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tobis Programm forked to not destroy your golden files
Fork of Robocode by
source/StartUp.cpp@120:cdf7a6751f9e, 2017-05-12 (annotated)
- Committer:
- cittecla
- Date:
- Fri May 12 15:20:45 2017 +0000
- Revision:
- 120:cdf7a6751f9e
- Parent:
- 119:eb212467afb0
- Child:
- 128:6bde4483ce7b
Initial positioning is more or less working; distance calcualtion is not correct, State machine set to run through until move with list
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 | 60:b57577b0072f | 3 | bool stb = false; |
cittecla | 60:b57577b0072f | 4 | bool stb2 = false; |
cittecla | 60:b57577b0072f | 5 | bool stb3 = false; |
cittecla | 38:3526c36e4c73 | 6 | |
cittecla | 71:ddf4eb5c3081 | 7 | int idle() |
cittecla | 57:1a395b6928ee | 8 | { |
cittecla | 60:b57577b0072f | 9 | |
cittecla | 60:b57577b0072f | 10 | if(get_user() == false && stb) { |
cittecla | 60:b57577b0072f | 11 | return 15; // button pressed |
cittecla | 57:1a395b6928ee | 12 | } else { |
cittecla | 60:b57577b0072f | 13 | stb = true; |
cittecla | 57:1a395b6928ee | 14 | return 10; |
cittecla | 38:3526c36e4c73 | 15 | } |
cittecla | 57:1a395b6928ee | 16 | } |
cittecla | 57:1a395b6928ee | 17 | |
cittecla | 71:ddf4eb5c3081 | 18 | int idle2() |
cittecla | 57:1a395b6928ee | 19 | { |
cittecla | 60:b57577b0072f | 20 | |
cittecla | 60:b57577b0072f | 21 | if(get_user() == false && stb2) { |
cittecla | 115:c8ea0cd9b20c | 22 | return 25; |
cittecla | 57:1a395b6928ee | 23 | } else { |
cittecla | 60:b57577b0072f | 24 | stb2 = true; |
cittecla | 60:b57577b0072f | 25 | wait_ms(100); |
cittecla | 57:1a395b6928ee | 26 | return 11; |
cittecla | 38:3526c36e4c73 | 27 | } |
cittecla | 57:1a395b6928ee | 28 | } |
cittecla | 38:3526c36e4c73 | 29 | |
cittecla | 57:1a395b6928ee | 30 | |
cittecla | 57:1a395b6928ee | 31 | int initialisation() |
cittecla | 57:1a395b6928ee | 32 | { |
cittecla | 57:1a395b6928ee | 33 | Robot_init_all(); |
cittecla | 57:1a395b6928ee | 34 | return 16; |
cittecla | 57:1a395b6928ee | 35 | } |
cittecla | 57:1a395b6928ee | 36 | |
cittecla | 57:1a395b6928ee | 37 | |
cittecla | 93:837a13760026 | 38 | int inital_arm_positioning() |
cittecla | 93:837a13760026 | 39 | { |
cittecla | 71:ddf4eb5c3081 | 40 | open_grabber(); |
cittecla | 93:837a13760026 | 41 | if(arm_position_release()) { |
cittecla | 93:837a13760026 | 42 | return 17; |
cittecla | 71:ddf4eb5c3081 | 43 | } |
cittecla | 93:837a13760026 | 44 | return 16; |
cittecla | 93:837a13760026 | 45 | } |
cittecla | 57:1a395b6928ee | 46 | |
cittecla | 57:1a395b6928ee | 47 | |
cittecla | 57:1a395b6928ee | 48 | int initial_turn() |
cittecla | 57:1a395b6928ee | 49 | { |
cittecla | 93:837a13760026 | 50 | |
cittecla | 60:b57577b0072f | 51 | if(stb3 == false) { |
cittecla | 60:b57577b0072f | 52 | stb3 = true; |
cittecla | 60:b57577b0072f | 53 | printf("initial turn...\r\n"); |
PESGruppe1 | 114:720dc5df42a5 | 54 | turn_for_deg(180,1); |
cittecla | 60:b57577b0072f | 55 | } else { |
cittecla | 60:b57577b0072f | 56 | printf("turning...\r\n"); |
cittecla | 120:cdf7a6751f9e | 57 | if(turn_for_deg(0,1) < 0) { // check if turning complete |
cittecla | 115:c8ea0cd9b20c | 58 | // printf("turn finished...\r\n"); |
cittecla | 115:c8ea0cd9b20c | 59 | |
cittecla | 120:cdf7a6751f9e | 60 | return 35; |
cittecla | 60:b57577b0072f | 61 | } |
cittecla | 60:b57577b0072f | 62 | } |
cittecla | 71:ddf4eb5c3081 | 63 | return 28; |
cittecla | 57:1a395b6928ee | 64 | } |