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: hole.cpp
- Revision:
- 2:23b20cbd3330
- Parent:
- 1:83459533ff72
diff -r 83459533ff72 -r 23b20cbd3330 hole.cpp
--- a/hole.cpp Mon May 01 15:20:26 2017 +0000
+++ b/hole.cpp Mon May 01 16:37:53 2017 +0000
@@ -5,23 +5,32 @@
void hole::hole_place()
{
-
+ int four = ((rand())%4)+1;
+ switch(four){
+ case 1:
//top left
holeX = rand()%27+5;
holeY = rand()%14+5;
-
+ break;
+
+ case 2:
// top right
- holeX1 = rand()%27+47;
- holeY1 = rand()%14+5;
+ holeX = rand()%27+47;
+ holeY = rand()%14+5;
+ break;
+ case 3:
// button left
- holeX2 = rand()%27+5;
- holeY2 = rand()%14+29;
+ holeX = rand()%27+5;
+ holeY = rand()%14+29;
+ break;
+ case 4:
//button right
- holeX3 = rand()%27+47;
- holeY3 = rand()%14+29;
-}
+ holeX = rand()%27+47;
+ holeY = rand()%14+29;
+ break;
+}}
void hole::hole_show()
{
@@ -43,7 +52,7 @@
bool check = false;
- if(x+41-3 <=holeX && holeX <=41+x+1+3 && y+24-3 <=holeY && y+24+6 >=holeY)
+ if(x+41-3 <=holeX && holeX <=41+x+1+3 && y+24-3 <=holeY && y+24+6 >=holeY )
{
printf("Check");
check = true;