![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tobis Programm forked to not destroy your golden files
Fork of Robocode by
source/Mapping.cpp@38:3526c36e4c73, 2017-04-04 (annotated)
- Committer:
- cittecla
- Date:
- Tue Apr 04 15:01:59 2017 +0000
- Revision:
- 38:3526c36e4c73
- Parent:
- 34:40d8d29b44b8
- Child:
- 39:92723f7ea54f
Started resolving State_Machine
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cittecla | 12:91c2e07d2b5b | 1 | /** |
cittecla | 12:91c2e07d2b5b | 2 | * Mapping function library |
cittecla | 12:91c2e07d2b5b | 3 | * Handels Mapping of the arena and LEGO-stones |
cittecla | 12:91c2e07d2b5b | 4 | **/ |
cittecla | 12:91c2e07d2b5b | 5 | |
cittecla | 38:3526c36e4c73 | 6 | #include "Mapping.h" |
cittecla | 38:3526c36e4c73 | 7 | |
cittecla | 12:91c2e07d2b5b | 8 | |
cittecla | 13:57f5a7876d2f | 9 | void mapping() |
cittecla | 13:57f5a7876d2f | 10 | { |
cittecla | 28:274e1d4ecac5 | 11 | //pseudo code |
cittecla | 38:3526c36e4c73 | 12 | // check_sensor(left); |
cittecla | 38:3526c36e4c73 | 13 | //check_sensor(right); |
cittecla | 38:3526c36e4c73 | 14 | return 0; |
cittecla | 28:274e1d4ecac5 | 15 | } |
cittecla | 28:274e1d4ecac5 | 16 | |
cittecla | 38:3526c36e4c73 | 17 | |
cittecla | 38:3526c36e4c73 | 18 | |
cittecla | 38:3526c36e4c73 | 19 | /* |
cittecla | 28:274e1d4ecac5 | 20 | void chack_sensor(sensor) |
cittecla | 28:274e1d4ecac5 | 21 | { |
cittecla | 28:274e1d4ecac5 | 22 | get_distance(); |
cittecla | 28:274e1d4ecac5 | 23 | if(sensor < 80cm || sensor > 10cm) { |
cittecla | 28:274e1d4ecac5 | 24 | calculate_position(sensor, distance); |
cittecla | 28:274e1d4ecac5 | 25 | check_map(position.this, obstacle); |
cittecla | 28:274e1d4ecac5 | 26 | if(map.no-entry){ |
cittecla | 28:274e1d4ecac5 | 27 | check_if_obstacle(distance); |
cittecla | 28:274e1d4ecac5 | 28 | update_map(); |
cittecla | 28:274e1d4ecac5 | 29 | } |
cittecla | 28:274e1d4ecac5 | 30 | } |
cittecla | 14:9e2ce5880fb0 | 31 | } |
cittecla | 28:274e1d4ecac5 | 32 | |
cittecla | 28:274e1d4ecac5 | 33 | void get_distance(sensor) |
cittecla | 28:274e1d4ecac5 | 34 | { |
cittecla | 28:274e1d4ecac5 | 35 | sensor.value; |
cittecla | 28:274e1d4ecac5 | 36 | return value; |
cittecla | 28:274e1d4ecac5 | 37 | } |
cittecla | 28:274e1d4ecac5 | 38 | |
cittecla | 28:274e1d4ecac5 | 39 | void calcualte_position(sensor, distance) |
cittecla | 28:274e1d4ecac5 | 40 | { |
cittecla | 28:274e1d4ecac5 | 41 | do math; |
cittecla | 28:274e1d4ecac5 | 42 | return position; |
cittecla | 28:274e1d4ecac5 | 43 | } |
cittecla | 28:274e1d4ecac5 | 44 | |
cittecla | 28:274e1d4ecac5 | 45 | void check_if_obstacle(distance) |
cittecla | 28:274e1d4ecac5 | 46 | { |
cittecla | 28:274e1d4ecac5 | 47 | move_scanner(); |
cittecla | 28:274e1d4ecac5 | 48 | distance2 = get_distance(sensor); |
cittecla | 28:274e1d4ecac5 | 49 | reset_scanner(); |
cittecla | 28:274e1d4ecac5 | 50 | if(distance -5cm < distance2 && distance +5cm > distance2) { |
cittecla | 28:274e1d4ecac5 | 51 | return 1; |
cittecla | 28:274e1d4ecac5 | 52 | } else { |
cittecla | 28:274e1d4ecac5 | 53 | return 0; |
cittecla | 28:274e1d4ecac5 | 54 | } |
cittecla | 29:e7d0208bf2af | 55 | }*/ |