Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: shot/shot.cpp
- Revision:
- 19:5083339b55e8
- Parent:
- 16:cf2bfada3adf
--- a/shot/shot.cpp Thu May 21 15:20:33 2020 +0000
+++ b/shot/shot.cpp Thu May 21 17:07:46 2020 +0000
@@ -33,7 +33,7 @@
_size = 7;
_size_f = 7.0;
- _p.resize(_size);
+ _p.resize(_size);//initalises 7 shots vector
srand(time(NULL));
for (std::vector<shot_posandtype>::iterator i = _p.begin(); i < _p.end(); i++) {
init_pos(i);
@@ -133,9 +133,9 @@
(((*i).x==3)&&((*i).y==18)) || (((*i).x==4)&&((*i).y==28))||
(((*i).x==79)&&((*i).y==16)) || (((*i).x==79)&&((*i).y==29)))
{
- init_pos(i);//generate new shots to keep the total number
+ init_pos(i);//generate new shots instead of those shots which beyoud border
(*i).type = ((*i).type + 2)%4;
- (*i).dir = ((*i).dir + 1)%6; // increase randomness
+ (*i).dir = ((*i).dir + 1)%6; // reset their type and dir (complex calculate to increase randomness)
}
}
}