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: main.cpp
- Revision:
- 15:78b28a43dd37
- Parent:
- 14:65249a106a6e
--- a/main.cpp Wed May 08 22:19:27 2019 +0000
+++ b/main.cpp Thu May 09 14:30:53 2019 +0000
@@ -19,15 +19,15 @@
element e;
int main(){
int n=20;
- int fps =8;
+ int fps =10;
init(n);//initialize
welcome();
- render(n);
+
+
wait(1.0f/fps);
//gameloop
while(1){
-
- update(n);//update the coodinate
+ update(n);//update the coordinate
render(n);// draw the graph
wait(1.0f/fps);
}
@@ -91,7 +91,7 @@
}
}
-void eat(int &n ){
+void eat(int &n ){//check if the coordinate of snake and food is the same
for(int i=0;i<2;i++)
{
@@ -198,7 +198,7 @@
}
}
-void hitself(int &n){
+void hitself(int &n){// check if the snake hit itself
for(int i=2;i<n;i++)
{
for(int j=0;j<2;j++)
@@ -296,4 +296,8 @@
}
}
+
+
+
+
\ No newline at end of file