My CPU
My CPU
Snoozer
Snoozer
'Murica Web
'Murica Web
Era of Nations
Era of Nations
Shredder
Shredder
BassJamb
BassJamb
FFII
FFII
explain.hlp
explain.hlp
My First Website
My First Website
Guestbook
Guestbook
Why I Created This
Why I Created This
FFF Archive
FFF Archive
Downloads
Downloads
DAOC story in 4 parts (and an epilogue).txt
DAOC story in 4 part...
DevCode 2001
DevCode 2001
AdBot Find & Fry
AdBot Find & Fry
HijackDat v1.99.1
HijackDat v1.99.1
n00bXfer 95
n00bXfer 95
FFOC Archive
FFOC Archive
Visitor Counter
Visitor Counter
POL Map Editor
POL Map Editor
pol.exe
pol.exe
Epic.exe
Epic.exe
Misc
Misc
DevCode 2001
FileEditSearchViewProjectExecuteHelp
shootlaser.cpp×
   1//2-3-03
   2Laser::Laser(int l, int size)
   3{
   4    boardsize = size;
   5    if((l >= 0) && ( l < boardsize))
   6    {
   7        mydirection = 'd';
   8        myrow = 0;
   9        mycol = l;
  10
  11    }
  12    else if (l<=19)
  13    {
  14        mydirection = 'l';
  15        myrow = l - size;
  16        mycol = 9;
  17
  18    }
  19    else if (l <=29)
  20    {
  21        mydirection = 'u';
  22        myrow = 9;
  23        mycol = 29-l;
  24    }
  25    else if (l <=39)
  26    {
  27        mydirection = 'r';
  28        myrow = 39 - l;
  29        mycol = 0;
  30
  31    }
  32
  33
  34
  35}
  36
  37
  38int Laser::row()
  39{
  40
  41    return myrow;
  42
  43}
  44
  45int Laser::col()
  46{
  47    return mycol;
  48}
  49void Laser::Move()
  50{
  51    if(mydirection =='d')
  52        myrow = myrow + 1;
  53    if(mydirection == 'u')
  54        myrow = myrow - 1;
  55    if(mydirection == 'r')
  56        mycol = mycol + 1;
  57    if(mydirection == 'l')
  58        mycol = mycol - 1;
  59}
  60
  61void Laser::HitSlash()
  62{
  63    if(mydirection =='u')
  64    {
  65        mycol = mycol + 1;
  66        mydirection = 'r';
  67    }
  68    if(mydirection == 'd')
  69    {
  70        mycol = mycol - 1;
  71        mydirection = 'l';
  72    }
  73    if(mydirection == 'r')
  74    {
  75        myrow = myrow - 1;
  76        mydirection = 'u';
  77    }
  78    if(mydirection == 'l')
  79    {
  80        myrow = myrow + 1;
  81        mydirection = 'd';
  82    }
  83}
  84
  85void Laser::HitBack()
  86{
  87    if(mydirection =='u')
  88    {
  89        mycol = mycol -1;
  90        mydirection = 'l';
  91    }
  92    if(mydirection == 'd')
  93    {
  94        mycol = mycol + 1;
  95        mydirection = 'r';
  96    }
  97    if(mydirection = 'r')
  98    {
  99        myrow = myrow + 1;
 100        mydirection = 'd';
 101    }
 102    if(mydirection = 'l')
 103    {
 104        myrow = myrow - 1;
 105        mydirection = 'l';
 106    }
 107}
 108
 109
 110void Board::ShootLaser()
 111{
 112    int shot = 0;
 113    cout <<" Where do you want to shoot your laser from?"<<endl;
 114    cin >> shot;
 115    Laser lazer(shot, size);
 116
 117    while(( lazer.row() >=0) && ( lazer.col()>= 0) && (lazer.row() <=9) && (lazer.col() <=9))
 118    {
 119        lazer.Move();
 120
 121        if((board[lazer.row()][lazer.col()] =='/')||(board[lazer.row()][lazer.col()] =='s'))
 122            lazer.HitSlash();
 123        if((board[lazer.row()][lazer.col()] =='\\')||(board[lazer.row()][lazer.col()] =='b'))
 124            lazer.HitBack();
 125
 126
 127
 128
 129        if(lazer.row() < 0)
 130            cout<<"The Laser exited at number " << lazer.col() << endl;
 131
 132        if(lazer.col() >= 9)
 133            cout<<"The Laser exited at number " << lazer.row() + 10 << endl;
 134
 135
 136        if(lazer.row() >= 9)
 137            cout<<"The Laser exited at number " << 29 -lazer.col() << endl;
 138
 139        if(lazer.col() < 0)
 140            cout<<"The Laser exited at number " << 39 - lazer.row() << endl;
 141
 142
 143    }
 144
 145
 146
 147}
Compiler Output
DevCode 2001 [Version 5.0.2]
Copyright (c) 2001 Borland Software Corp.

Ready.
shootlaser.cpp|CPP|Line 1, Col 1|Ready
Ready
🔊🌐
10:38 AM