Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
snake logic complete c++
/* **samuel ugochukwu nwutobo **sammycageagle@gmail.com */ #include <iostream> #include <iomanip> using namespace std; const int height = 10; const int width = 10; int nTail=4; int tailX[100],tailY[100]; int x; int y; int obx ; int oby; bool over; void Draw(); void status(); void setup(); void logic(); int main() { setup(); for(int i=0;i<10;i++) { Draw(); status(); logic(); } return 0; } void Draw() { for(int i=0; i<height; i++) { for(int j=0; j <width; j++) { if(j ==0) cout<<"¤"; if(i ==y && j ==x) cout<<"O"; else if(i ==oby && j== obx) cout<<"€"; else { bool print=false; for(int k= nTail;k > 0; --k) { if(tailX[k]==j&&tailY[k]==i) { cout<<"o"; print =true; }} if(!print) cout<<" "; } if(j==width-1) cout<<"¤"; } cout<<endl; } for(int i =0; i<8;i++) cout<<"¤ "; cout<<endl; cout<<endl; } void status() { obx =9; oby -=1; } void setup() { obx = 0; oby = 9; x = 9; y = 0; } void logic() { tailX[0]=obx; tailY[0]=oby; for(int i=nTail; i >0 ; --i) { tailX[i] = tailX[i-1]; tailY[i] = tailY[i-1]; } }
run
|
edit
|
history
|
help
0
Fundamentos de programación. Tema 7. Ejercicio 6. Con funciones.
Yo que se
不带头结点的单链表
dsu on tree(264E BLOOD COUSIN RETURNS)
binder
int divide by int
CPP - Arrays - Ex.2
articulation points (http://codeforces.com/contest/732/problem/F)
Best buy/sell day in stock
integer division