Hello everyone, Here we implements Snake and Ladder Game in C++ graphic.
A two player Snake and Ladder game in C++ Graphics :
A two player Snake and Ladder game in C++ Graphics :
Source Code
#include<stdio.h> #include<graphics.h> #include<conio.h> #include<malloc.h> #include<stdlib.h> #include<dos.h> #include<iostream.h> int k=1, i, user=0, dice=0, x1=50, y1=410, x2=70, y2=410, dir1=0, dir2=0, ch; int cnt1=1, cnt2=1; void *obj1, *obj2, *o1, *o2, *dot, *back, *turn, *ready; unsigned int size; void ladder1() { int m,n; for(m=0;m<=250;m+=250) for(n=0;n<=m;n+=250) { setcolor(DARKGRAY); line(53+m,57+n,55+m,55+n); line(53+m,57+n,133+m,137+n); line(55+m,55+n,135+m,135+n); line(133+m,137+n,135+m,135+n); setfillstyle(SOLID_FILL, YELLOW); floodfill(55+m,58+n,DARKGRAY); line(68+m,42+n,70+m,40+n); line(68+m,42+n,148+m,122+n); line(70+m,40+n,150+m,120+n); line(148+m,122+n,150+m,120+n); floodfill(70+m,43+n,DARKGRAY); line(65+m,65+n,78+m,52+n); line(68+m,68+n,81+m,55+n); floodfill(79+m,54+n,DARKGRAY); line(75+m,75+n,88+m,62+n); line(78+m,78+n,91+m,65+n); floodfill(89+m,64+n,DARKGRAY); line(85+m,85+n,98+m,72+n); line(88+m,88+n,101+m,75+n); floodfill(99+m,74+n,DARKGRAY); line(95+m,95+n,108+m,82+n); line(98+m,98+n,111+m,85+n); floodfill(109+m,84+n,DARKGRAY); line(105+m,105+n,118+m,92+n); line(108+m,108+n,121+m,95+n); floodfill(119+m,94+n,DARKGRAY); line(115+m,115+n,128+m,102+n); line(118+m,118+n,131+m,105+n); floodfill(129+m,104+n,DARKGRAY); line(125+m,125+n,138+m,112+n); line(128+m,128+n,141+m,115+n); floodfill(139+m,114+n,DARKGRAY); } }
Download Full Source Code: Click Here
Output
Also Read: Quine - Print its own Source Code as Output
NOTE: Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
0 comments:
Post a Comment