Tobis Programm forked to not destroy your golden files
Fork of Robocode by
source/StartUp.cpp@136:906ac19fb850, 2017-05-22 (annotated)
- Committer:
- PESGruppe1
- Date:
- Mon May 22 13:18:13 2017 +0000
- Revision:
- 136:906ac19fb850
- Parent:
- 134:5c29654ce301
New finepostitioning mit vor und zur?ckdrehen 1 grad;
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 | 132:8ae08f41bb43 | 7 | bool printf_state = 0; |
cittecla | 132:8ae08f41bb43 | 8 | |
cittecla | 71:ddf4eb5c3081 | 9 | int idle() |
cittecla | 57:1a395b6928ee | 10 | { |
cittecla | 132:8ae08f41bb43 | 11 | if(printf_state == 0) printf("idle1...\r\n"); printf_state = 1; |
cittecla | 60:b57577b0072f | 12 | if(get_user() == false && stb) { |
cittecla | 132:8ae08f41bb43 | 13 | printf_state = 0; |
cittecla | 60:b57577b0072f | 14 | return 15; // button pressed |
cittecla | 57:1a395b6928ee | 15 | } else { |
cittecla | 60:b57577b0072f | 16 | stb = true; |
cittecla | 57:1a395b6928ee | 17 | return 10; |
cittecla | 38:3526c36e4c73 | 18 | } |
cittecla | 57:1a395b6928ee | 19 | } |
cittecla | 57:1a395b6928ee | 20 | |
cittecla | 71:ddf4eb5c3081 | 21 | int idle2() |
cittecla | 57:1a395b6928ee | 22 | { |
cittecla | 132:8ae08f41bb43 | 23 | if(printf_state == 0) printf("idle2...\r\n"); printf_state = 1; |
cittecla | 60:b57577b0072f | 24 | if(get_user() == false && stb2) { |
cittecla | 132:8ae08f41bb43 | 25 | printf_state = 0; |
cittecla | 115:c8ea0cd9b20c | 26 | return 25; |
cittecla | 57:1a395b6928ee | 27 | } else { |
cittecla | 60:b57577b0072f | 28 | stb2 = true; |
cittecla | 60:b57577b0072f | 29 | wait_ms(100); |
cittecla | 57:1a395b6928ee | 30 | return 11; |
cittecla | 38:3526c36e4c73 | 31 | } |
cittecla | 57:1a395b6928ee | 32 | } |
cittecla | 38:3526c36e4c73 | 33 | |
cittecla | 57:1a395b6928ee | 34 | |
cittecla | 57:1a395b6928ee | 35 | int initialisation() |
cittecla | 57:1a395b6928ee | 36 | { |
cittecla | 57:1a395b6928ee | 37 | Robot_init_all(); |
cittecla | 57:1a395b6928ee | 38 | return 16; |
cittecla | 57:1a395b6928ee | 39 | } |
cittecla | 57:1a395b6928ee | 40 | |
cittecla | 57:1a395b6928ee | 41 | |
cittecla | 93:837a13760026 | 42 | int inital_arm_positioning() |
cittecla | 93:837a13760026 | 43 | { |
cittecla | 71:ddf4eb5c3081 | 44 | open_grabber(); |
cittecla | 93:837a13760026 | 45 | if(arm_position_release()) { |
cittecla | 93:837a13760026 | 46 | return 17; |
cittecla | 71:ddf4eb5c3081 | 47 | } |
cittecla | 93:837a13760026 | 48 | return 16; |
cittecla | 93:837a13760026 | 49 | } |
cittecla | 57:1a395b6928ee | 50 | |
cittecla | 57:1a395b6928ee | 51 | |
cittecla | 57:1a395b6928ee | 52 | int initial_turn() |
cittecla | 57:1a395b6928ee | 53 | { |
cittecla | 93:837a13760026 | 54 | |
cittecla | 60:b57577b0072f | 55 | if(stb3 == false) { |
cittecla | 60:b57577b0072f | 56 | stb3 = true; |
cittecla | 60:b57577b0072f | 57 | printf("initial turn...\r\n"); |
PESGruppe1 | 114:720dc5df42a5 | 58 | turn_for_deg(180,1); |
cittecla | 60:b57577b0072f | 59 | } else { |
cittecla | 134:5c29654ce301 | 60 | //printf("turning...\r\n"); |
cittecla | 120:cdf7a6751f9e | 61 | if(turn_for_deg(0,1) < 0) { // check if turning complete |
cittecla | 134:5c29654ce301 | 62 | printf("turn finished...\r\n"); |
cittecla | 130:670a954495bf | 63 | //print_map(0); |
cittecla | 120:cdf7a6751f9e | 64 | return 35; |
cittecla | 60:b57577b0072f | 65 | } |
cittecla | 60:b57577b0072f | 66 | } |
cittecla | 71:ddf4eb5c3081 | 67 | return 28; |
cittecla | 57:1a395b6928ee | 68 | } |