Subversion Repositories svnkaklik

Rev

Rev 277 | Rev 280 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
276 kaklik 1
program Orbis;
275 kaklik 2
 
277 kaklik 3
var line, movement, Rychlost;
275 kaklik 4
 
276 kaklik 5
#define L 1
6
#define S 2
7
#define R 3
275 kaklik 8
 
276 kaklik 9
line:=2;
10
 
11
Rychlost:=15;		# omezeni rychlosti (hlavne pro ladici ucely)
12
 
13
while true
275 kaklik 14
do
277 kaklik 15
  if LEYE = 1 and CEYE = 1 and REYE = 0 then 
278 kaklik 16
    LMOT:=-1;RMOT:=Rychlost*0.75;			# jed rovne
276 kaklik 17
    line:=1;		# zaznamenej, kdes videl caru
277 kaklik 18
    movement:=1;
276 kaklik 19
    continue;
20
  end;
275 kaklik 21
 
277 kaklik 22
  if LEYE = 0 and CEYE = 1 and REYE = 1 then 
278 kaklik 23
    LMOT:=Rychlost*0.75;RMOT:=-1;
277 kaklik 24
    line:=3;
278 kaklik 25
    movement:=3;
277 kaklik 26
    continue;
27
  end;
28
 
29
  if LEYE = 1 and CEYE = 0 and REYE = 0 then 
278 kaklik 30
    LMOT:=-Rychlost/2;RMOT:=Rychlost;			# jed rovne
277 kaklik 31
    line:=1;		# zaznamenej, kdes videl caru
32
    movement:=1;
33
    continue;
34
  end;
35
 
36
  if LEYE = 0 and CEYE = 0 and REYE = 1 then 
278 kaklik 37
    LMOT:=Rychlost;RMOT:=-Rychlost/2;
276 kaklik 38
    line:=3;
277 kaklik 39
    movement:=3;
276 kaklik 40
    continue;
41
  end;
275 kaklik 42
 
277 kaklik 43
  if (LEYE = 0 and CEYE = 1 and REYE = 0) then 
278 kaklik 44
    LMOT:=Rychlost;RMOT:=Rychlost;
276 kaklik 45
    line:=2;
278 kaklik 46
    movement:=2;
276 kaklik 47
    continue;
275 kaklik 48
  end;
277 kaklik 49
 
50
  if (LEYE = 1 and CEYE = 1 and REYE = 1) then 
278 kaklik 51
    if movement = 1 then
52
      LMOT:=Rychlost;RMOT:=0;
53
      line:=2;
54
#      break;
55
 
56
    elif movement = 2 then
57
      LMOT:=Rychlost;RMOT:=Rychlost;
58
      line:=2;
59
#      break;
60
 
61
    elif movement = 3 then
62
      LMOT:=0;RMOT:=Rychlost;
63
      line:=2;
64
    end;
277 kaklik 65
  end;
66
 
67
  if (LEYE = 0 and CEYE = 0 and REYE = 0) then 
278 kaklik 68
    if line = 1 then
69
      LMOT:=0;RMOT:=Rychlost;
70
      line:=2;
71
      movement:=1;
72
 
73
    elif movement = 3 then
277 kaklik 74
      LMOT:=Rychlost;RMOT:=0;
75
      line:=2;
76
      movement:=3;
278 kaklik 77
    end;
277 kaklik 78
  end;    
275 kaklik 79
end;