Cómo escribir una serpiente en C#include #include #include #include #include #include int grado=5,punto=0,vida=3,menu(),move_head(),move_body(),move(),init_insect(),left(); , sobre(),derecha(),abajo(),init_graph(),food_f(),ahead(),crate(); error de estructura { int x; error de estructura *último; struct fd { int x; int y; int juez; }comida={0,0,0}; error de estructura *head_f=NULL,*head_l,*p1=NULL,*p2=NULL; ; initgraph(800,600); set(); init_insect(); while(1) { food_f(); dormir(grado*10); set() Dormir(grado*10); ; x,head_l->y,2); setcolor(BLANCO); move_body(); if(kbhit()) { ch=getch(); if(ch==27) { set(); else if(ch==-32) { switch(getch()) { case 72:break;case80:down();break;case75:left();break;case77:right();break;} más adelante( ) ;} else getch()} else forward(); } else { forward(); if(head_f->x==food.x&&head_f->y==food.y) { Sleep(100); ; comida.juez=0; punto=punto+(6- grado)*10; if(comida.x<30||comida.y<30||comida.x>570||comida.y>570) vida++; ( } if(head_f->x<5||head_f->x>595||head_f->y<5||head_f->y>595) { Dormir(1000); = 0; init_graph(); init_insect(); menú(); - >y==p1->y) { Dormir(1000); vida--; comida.juez=0; menú init();
enu(); init_insect(); menú(); menú(); init_insect(); menú(); descanso; { outtextxy(280,300, "¡Se acabó el juego!"); getch(); return; } mover() }; void init_graph() { setlinestyle(PS_SOLID,1,5); ; setlinestyle(PS_ SOLID,1,1); } void set() { init_graph(); outtextxy(640,50, "1. Inicio/Retorno"); (640,90, "3. Dificultad"); outtextxy(640,110, "4. Empezar de nuevo"); switch(getch()) { case '1':menu();setcolor(VERDE);circle(food.case '3': outtextxy(700,90,":1 2 3 4 5");calificación=getch()-48;set();break; caso '4': comida.comida.juez=0,calificación=5 ;punto=0;vida=3;init_insect();menú();descanso;caso '4': comida.juez=0,calificación=5;punto=0;vida=3;init_insect();menú(); break break; predeterminado: outtextxy(250,300, "¡Error de entrada!"); set();break } void menu() { char str.} void menu() { char str[20],str1[]={"Puntuación :"},str2[]={"Dificultad:"},str3[]={"Duración:"}; init_graph(); sprintf(str,"%d",punto); strcat( str1,str); outtextxy (640,50,str1); sprintf(str,"%d",grado); strcat(str2,str); outtextxy(640,70,str2); str3,str); outtextxy(640,90,str3); outtextxy(640,110, "Configuración: void init_insect() { head_f=(error de estructura *)malloc(sizeof(error de estructura)); head_ f->last=NULL; head_f->x=300; head_f->y=300; p2=head_f->next=p1=(error de estructura *)malloc(sizeof(error de estructura)); 295; p1->y=300; p1=p1->siguiente=(error de estructura *)malloc(sizeof(error de estructura)); ; p1->