Posts

Showing posts from January, 2017

THE_CLASSIC _SNAKE IN C++

Image
SOURCE CODE :   //For Youtube tutorials : https://goo.gl/s4rZwP # include <iostream> #include<windows.h> #include<stdlib.h> #include<time.h> #include <conio.h> using namespace std; int i,y,pos[50],length=3,temp,j,f_PosX,f_PosY,movement,head_x=25; int head_y=12,game=1,s_pos_X[200],s_pos_Y[200],temp_x[200],temp_y[200],score=0,wait=200,count=0; char rc=187,hl=205,vl=186,lc=201,ldc=200,rdc=188,t=203,td=202,food=153,sn=254,key; void gotoxy( int x, int y ) { COORD p = {x, y}; SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ), p ); } char snake[200]; void move(); void in_snake(); void pos_val(); void boder(); void food_pos(); void show_food(); void sn_dir(); void pause_play(); void game_play(); void sn_eat(); void check(); void start(); int main() { boder(); key=getch(); Sleep(10); if(key=='p'|| key=='P') { start(); } else { main(); } } void move() { if(movement==6) { gotoxy(s_p...