SlideShare a Scribd company logo
Name: Suraj R. Maurya
Course: CO3G
Batch: X
Roll.no: 162218
6 : MINI PROJECT
Aim: Professional Ludus.(Using C++)
Source code:
#include<graphics.h>
#include<fstream.h>
#include<string.h>
#include<stdlib.h>
#include<limits.h>
#include<ctype.h>
#include<conio.h>
#include<stdio.h>
#include<dos.h>
int ppos[53][2],wincount=0,win[4]={0,0,0,0},seed=0;
int safepos[8]={1,9,14,22,27,35,40,48};
int ipos[4][8]={
65,125, 335, 65, 395,335, 125,395, 65, 65, 395, 65, 335,395, 65,395,
125, 65, 335,125, 335,335, 125,335, 125,125, 395,125, 395,395, 65,335,
};
int grid[58][8]={
65,125, 335, 65, 395,335, 125,395, 50,200, 260, 50, 410,260, 200,410,
80,200, 260, 80, 380,260, 200,380, 110,200, 260,110, 350,260, 200,350,
140,200, 260,140, 320,260, 200,320, 170,200, 260,170, 290,260, 200,290,
200,170, 290,200, 260,290, 170,260, 200,140, 320,200, 260,320, 140,260,
200,110, 350,200, 260,350, 110,260, 200, 80, 380,200, 260,380, 80,260,
200, 50, 410,200, 260,410, 50,260, 200, 20, 440,200, 260,440, 20,260,
230, 20, 440,230, 230,440, 20,230, 260, 20, 440,260, 200,440, 20,200,
260, 50, 410,260, 200,410, 50,200, 260, 80, 380,260, 200,380, 80,200,
260,110, 350,260, 200,350, 110,200, 260,140, 320,260, 200,320, 140,200,
260,170, 290,260, 200,290, 170,200, 290,200, 260,290, 170,260, 200,170,
320,200, 260,320, 140,260, 200,140, 350,200, 260,350, 110,260, 200,110,
380,200, 260,380, 80,260, 200, 80, 410,200, 260,410, 50,260, 200, 50,
440,200, 260,440, 20,260, 200, 20, 440,230, 230,440, 20,230, 230, 20,
440,260, 200,440, 20,200, 260, 20, 410,260, 200,410, 50,200, 260, 50,
380,260, 200,380, 80,200, 260, 80, 350,260, 200,350, 110,200, 260,110,
320,260, 200,320, 140,200, 260,140, 290,260, 200,290, 170,200, 260,170,
260,290, 170,260, 200,170, 290,200, 260,320, 140,260, 200,140, 320,200,
260,350, 110,260, 200,110, 350,200, 260,380, 80,260, 200, 80, 380,200,
260,410, 50,260, 200, 50, 410,200, 260,440, 20,260, 200, 20, 440,200,
230,440, 20,230, 230, 20, 440,230, 200,440, 20,200, 260, 20, 440,260,
200,410, 50,200, 260, 50, 410,260, 200,380, 80,200, 260, 80, 380,260,
200,350, 110,200, 260,110, 350,260, 200,320, 140,200, 260,140, 320,260,
200,290, 170,200, 260,170, 290,260, 170,260, 200,170, 290,200, 260,290,
140,260, 200,140, 320,200, 260,320, 110,260, 200,110, 350,200, 260,350,
80,260, 200, 80, 380,200, 260,380, 50,260, 200, 50, 410,200, 260,410,
20,260, 200, 20, 440,200, 260,440, 20,230, 230, 20, 440,230, 230,440,
50,230, 230, 50, 410,230, 230,410, 80,230, 230, 80, 380,230, 230,380,
110,230, 230,110, 350,230, 230,350, 140,230, 230,140, 320,230, 230,320,
170,230, 230,170, 290,230, 230,290, 210,230, 230,200, 260,230, 230,260,
};
int st1a[]={200, 67,189, 87,211, 87},st1b[]={189, 73,200, 93,211, 73};
int st2a[]={380,187,369,207,391,207},st2b[]={369,193,380,213,391,193};
int st3a[]={260,367,249,387,271,387},st3b[]={249,373,260,393,271,373};
int st4a[]={ 80,247, 69,267, 91,267},st4b[]={ 69,253, 80,273, 91,253};
class player
{
int colour[4],key,code,dice[4],dnum,tnum,AI;
int calpos(int,int);
int decide(int);
int dscore(int);
int movecheck(int,int);
void roll();
void show(int);
void killcheck(int);
int stchk(int);
void repaint(int);
void typewinner();
void mksound()
{
sound(1500);delay(55);
nosound();tnum++;
}
public:
char name[20],cho[5],tname[20];
int gpos[4],result;
void turn();
void move(int,int);
void pinit(int a,int b,int c,int d,int y,char pname[],int ai)
{
gpos[0]=gpos[1]=gpos[2]=gpos[3]=dnum=tnum=0;
colour[0]=a;colour[1]=b;colour[2]=c;colour[3]=d;
key=y;result=0;AI=ai;code=key/2;strcpy(name,pname);
strcat(tname,name);strcat(tname,"'s Turn");
}
};
player green,yellow,blue,red;
int player::stchk(int d)
{
for(int k=0;k<8;k++)
{
int dis=d-safepos[k];
if(dis==0)
return(1);
else if(dis<0)
return(0);
}
return(0);
}
int player::dscore(int d)
{
if(d>=1 && d<=6)
return(2);
else if(d>=7 && d<=12)
return(1);
else
return(0);
}
int player::calpos(int position, int pcode)
{
switch(pcode)
{
case 0:return(position-1);
case 1:return((position+12)%52);
case 2:return((position+25)%52);
case 3:return((position+38)%52);
}
return(0);
}
void box()
{
textcolor(1);gotoxy(3,2);putch(201);
for(int i=4;i<=77;i++)
putch(205);
putch(187);
for(i=3;i<=23;i++)
{
gotoxy(78,i);putch(186);
}
gotoxy(78,24);putch(188);
for(i=77;i>=4;i--)
{
gotoxy(i,24);putch(205);
}
gotoxy(3,24);putch(200);
for(i=23;i>=3;i--)
{
gotoxy(3,i);putch(186);
}
}
void intro()
{
clrscr();box();
char name[20],ch;
textcolor(6);
gotoxy(21,3);cputs("____________________________________");
gotoxy(22,4);cputs("Welcome to Professional LUDUS v1.0");
gotoxy(21,5);cputs("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
textcolor(2);
gotoxy(10,7);cputs("GREEN PLAYER");
gotoxy(15,8);cputs("Enter Name:");gets(name);
gotoxy(15,9);cputs("Computer Controlled? (y/n):");ch=getche();
if(toupper(ch)=='Y')
green.pinit(2,14,9,4,0,name,1);
else
green.pinit(2,14,9,4,0,name,0);
textcolor(14);
gotoxy(10,11);cputs("YELLOW PLAYER");
gotoxy(15,12);cputs("Enter Name:");gets(name);
gotoxy(15,13);cputs("Computer Controlled? (y/n):");ch=getche();
if(toupper(ch)=='Y')
yellow.pinit(14,9,4,2,2,name,1);
else
yellow.pinit(14,9,4,2,2,name,0);
textcolor(9);
gotoxy(10,15);cputs("BLUE PLAYER");
gotoxy(15,16);cputs("Enter Name:");gets(name);
gotoxy(15,17);cputs("Computer Controlled? (y/n):");ch=getche();
if(toupper(ch)=='Y')
blue.pinit(9,4,2,14,4,name,1);
else
blue.pinit(9,4,2,14,4,name,0);
textcolor(4);
gotoxy(10,19);cputs("RED PLAYER");
gotoxy(15,20);cputs("Enter Name:");gets(name);
gotoxy(15,21);cputs("Computer Controlled? (y/n):");ch=getche();
if(toupper(ch)=='Y')
red.pinit(4,2,14,9,6,name,1);
else
red.pinit(4,2,14,9,6,name,0);
delay(100);
}
void quit()
{
cleardevice();closegraph();
clrscr();box();textcolor(4);
gotoxy(20,11);cputs("*************************************n");
gotoxy(20,12);cputs("Thank you for using this software....n");
gotoxy(20,13);cputs("*************************************n");
delay(2000);
for(int i=23;i>=7;i-=1)
{
clrscr();box();textcolor(14);
gotoxy(32,5);cputs("CREDITS");
gotoxy(32,6);cputs("~~~~~~~");
if(i<24)
{
gotoxy(23,i);
cputs("Professional LUDUS ");
}
if(i<23)
{
gotoxy(22,1+i);
cputs("~~~~~~~~~~~~~~~~~~~~~~~~~~");
}
if(i<21)
{
gotoxy(22,3+i);
cputs("Concept & Coding : Suraj");
}
if(i<20)
{
gotoxy(22,4+i);
cputs("Design & Graphics : Suraj");
}
if(i<19)
{
gotoxy(22,5+i);
cputs("Supervisor : Suraj");
}
if(i<18)
{
gotoxy(22,6+i);
cputs("Language : Borland Turbo C++");
}
if(i<16)
{
gotoxy(10,8+i);cputs("This software is protected by ");
cputs("international rights and policies.");
}
if(i<14)
{
gotoxy(10,10+i);cputs("Reproduction without ");
cputs("permission is punishable under law.");
}
delay(100);
}
delay(2000);getch();
exit(0);
}
void drawstar()
{
setcolor(2);setfillstyle(1,2);fillpoly(3,st1a);fillpoly(3,st1b);
setcolor(14);setfillstyle(1,14);fillpoly(3,st2a);fillpoly(3,st2b);
setcolor(9);setfillstyle(1,9);fillpoly(3,st3a);fillpoly(3,st3b);
setcolor(4);setfillstyle(1,4);fillpoly(3,st4a);fillpoly(3,st4b);
}
void board()
{
char str[100]={"Professional LUDUS "};
setcolor(2);settextstyle(1,0,2);
outtextxy(115,455,str);
strcpy(str,"Made By - Suraj");
setcolor(14);settextstyle(2,0,5);
outtextxy(420,465,str);
int ar1[]={185,185,230,230,185,275};
int ar2[]={185,185,230,230,275,185};
int ar3[]={275,185,230,230,275,275};
setcolor(15);
setfillstyle(1,2);bar3d(35,185,65,245,0,0);bar3d(65,215,185,245,0,0);
setfillstyle(1,14);bar3d(215,35,275,65,0,0);bar3d(215,65,245,185,0,0);
setfillstyle(1,4);bar3d(215,275,245,395,0,0);bar3d(185,395,245,425,0,0);
setfillstyle(1,9);bar3d(275,215,395,245,0,0);bar3d(395,215,425,275,0,0);
for(int i=5;i<=455;i+=30)
{
line(5,i,455,i);line(i,5,i,455);
}
setfillstyle(1,2);bar3d(5,5,185,185,0,0);
setfillstyle(1,15);bar3d(35,35,155,155,0,0);
setcolor(2);
setlinestyle(1,1,3);
circle(65,65,14);circle(65,125,14);
circle(125,65,14);circle(125,125,14);
setlinestyle(0,0,1);setcolor(15);
setfillstyle(1,14);bar3d(275,5,455,185,0,0);
setfillstyle(1,15);bar3d(305,35,425,155,0,0);
setcolor(14);
setlinestyle(1,1,3);
circle(335,65,14);circle(395,65,14);
circle(335,125,14);circle(395,125,14);
setlinestyle(0,0,1);setcolor(15);
setfillstyle(1,4);bar3d(5,275,185,455,0,0);
setfillstyle(1,15);bar3d(35,305,155,425,0,0);
setcolor(4);
setlinestyle(1,1,3);
circle(65,335,14);circle(65,395,14);
circle(125,335,14);circle(125,395,14);
setlinestyle(0,0,1);setcolor(15);
setfillstyle(1,9);bar3d(275,275,455,455,0,0);
setfillstyle(1,15);bar3d(305,305,425,425,0,0);
setcolor(9);
setlinestyle(1,1,3);
circle(335,335,14);circle(335,395,14);
circle(395,335,14);circle(395,395,14);
setlinestyle(0,0,1);setcolor(15);
setfillstyle(1,4);bar3d(185,185,275,275,0,0);
setfillstyle(1,2);fillpoly(3,ar1);
setfillstyle(1,14);fillpoly(3,ar2);
setfillstyle(1,9);fillpoly(3,ar3);
drawstar();setcolor(6);setfillstyle(1,0);
bar3d(460,5,635,275,0,0);
bar3d(460,280,635,375,0,0);
bar3d(460,380,635,455,0,0);
bar3d(520,92,540,112,0,0);
bar3d(540,92,560,112,0,0);
bar3d(560,92,580,112,0,0);
settextstyle(2,0,5);
outtextxy(467,285,"Winner:");
outtextxy(465,305,"2nd :");
outtextxy(465,325,"3rd :");
outtextxy(465,345,"Loser :");
outtextxy(465,380,"To EXIT press 'q'");
outtextxy(465,395,"in between the turns...");
outtextxy(465,420,"Email Suggestions at :");
outtextxy(465,435,"nkrsharma@gmail.com");
}
void player::typewinner()
{
result=1;wincount++;win[code]=1;
setcolor(colour[0]);settextstyle(2,0,5);
switch(wincount)
{
case 1: outtextxy(520,285,name);break;
case 2: outtextxy(520,305,name);break;
case 3:
{
outtextxy(520,325,name);
for(int i=0;i<4;i++)
if(win[i]==0)
switch(i)
{
case 0: green.typewinner();
case 1: yellow.typewinner();
case 2: blue.typewinner();
case 3: red.typewinner();
}
break;
}
case 4:
{
outtextxy(520,345,name);
getch();quit();
}
}
}
void player::show(int n)
{
setcolor(0);setfillstyle(1,15);
bar3d(530,50,570,90,0,0);
switch(n)
{
case 1:
{
setfillstyle(1,0);
fillellipse(550,70,4,4);
break;
}
case 2:
{
setfillstyle(1,0);
fillellipse(540,60,4,4);
fillellipse(560,80,4,4);
break;
}
case 3:
{
setfillstyle(1,0);
fillellipse(560,60,4,4);
fillellipse(550,70,4,4);
fillellipse(540,80,4,4);
break;
}
case 4:
{
setfillstyle(1,0);
fillellipse(540,60,4,4);
fillellipse(540,80,4,4);
fillellipse(560,60,4,4);
fillellipse(560,80,4,4);
break;
}
case 5:
{
setfillstyle(1,0);
fillellipse(540,60,4,4);
fillellipse(540,80,4,4);
fillellipse(560,60,4,4);
fillellipse(560,80,4,4);
fillellipse(550,70,4,4);
break;
}
case 6:
{
setfillstyle(1,0);
fillellipse(540,60,4,4);
fillellipse(540,70,4,4);
fillellipse(540,80,4,4);
fillellipse(560,60,4,4);
fillellipse(560,70,4,4);
fillellipse(560,80,4,4);
}
}
}
void player::killcheck(int num)
{
int z=gpos[num],x=calpos(z,code),hitc,hitn;
if(z<=51 && stchk(z)==0)
{
hitc=ppos[x][0];hitn=ppos[x][1];
ppos[x][0]=code;ppos[x][1]=num;
if(hitc!=-1)
{
switch(hitc)
{
case 0:green.move(hitn,-1);break;
case 1:yellow.move(hitn,-1);break;
case 2:blue.move(hitn,-1);break;
case 3:red.move(hitn,-1);break;
}
repaint(num);mksound();
}
}
}
int player::movecheck(int d,int num=-1)
{
if(num==-1)
{
for(int i=0;i<4;i++)
{
if(gpos[i]==0 && d==6)
return(1);
if(gpos[i]!=0 && (gpos[i]+d)<=57)
{
int flag1=1;
for(int l=0;l<4;l++)
if(gpos[i]+d==gpos[l] && stchk(gpos[l])!=1)
if(gpos[l]!=57)
flag1=0;
if(flag1)
return(1);
}
}
}
else
{
if(gpos[num]==0 && d==6)
return(1);
if(gpos[num]!=0 && (gpos[num]+d)<=57)
{
for(int l=0;l<4;l++)
if(gpos[num]+d==gpos[l] && stchk(gpos[l])!=1)
if(gpos[l]!=57)
return(0);
return(1);
}
}
return(0);
}
void player::roll()
{
char ch,str[10];
setcolor(0);setfillstyle(1,0);bar3d(461,113,634,274,0,0);
setcolor(6);setfillstyle(1,0);
randomize();
if(dnum==0)
for(int i=0;i<3;i++)
bar3d(520+20*i,92,540+20*i,112,0,0);
settextstyle(2,0,5);outtextxy(480,30, "Hit any key to Roll.");
setcolor(0);
if(!AI)
{
do
{
dice[dnum]=random(6)+1;
show(dice[dnum]);delay(25);
}while(!kbhit());
ch=getche();
//if(ch>='i' && ch<='n')
//{
// show(ch-104);dice[dnum]=ch-104;
//}
if(toupper(ch)=='Q')
quit();
}
else
{
int stopper=(seed*2)%20+20;
for(int i=0;i<stopper;i++)
{
dice[dnum]=random(6)+1;
show(dice[dnum]);delay(25);
}
}
setcolor(6);gcvt(dice[dnum],1,str);
settextstyle(4,0,1);outtextxy(526+dnum*20,89,str);
dnum++;seed++;
}
int player::decide(int dic)
{
int score[4]={0,0,0,0},a,b,x,y,dist,max,token;
max=INT_MIN;token=-1;
for(int i=0;i<4;i++)
{
a=gpos[i];b=a+dic;
x=calpos(a,code);y=calpos(b,code);
if(movecheck(dic,i)==0) //position on board
score[i]-=100;
if(a==0 && dic==6)
score[i]+=7;
if(a>45 && a<52)
score[i]+=5;
else if(a>40 && a<52)
score[i]+=3;
else if(a>27)
score[i]+=1;
if(b==57)
score[i]+=2;
if(ppos[y][0]!=-1 && ppos[y][0]!=code && a<51) //attack
score[i]+=10;
if((a<51 && b>51) || stchk(b)==1) //future position
score[i]+=3;
if(movecheck(dic,i)==1 && b<52)
{
for(int j=1;j<13;j++) //look enemy behind
{
if((y-j)>=0)
if(ppos[y-j][0]!=-1 && ppos[y-j][0]!=code)
score[i]-=dscore(j);
else
{
int ind=(52+y-j);
if(ppos[ind][0]!=-1 && ppos[ind][0]!=code)
score[i]-=dscore(j);
}
}
for(j=1;j<13;j++) //look enemy infront
{
if((y+j)<=51)
if(ppos[y+j][0]!=-1 && ppos[y+j][0]!=code)
score[i]+=dscore(j);
else
{
int ind=(y+j-52);
if(ppos[ind][0]!=-1 && ppos[ind][0]!=code)
score[i]+=dscore(j);
}
}
}
if(a>51 || stchk(a)==1) //current position
score[i]-=4;
if(movecheck(dic,i)==1 && a<52)
{
for(int j=1;j<13;j++) //look enemy behind
{
if((x-j)>=0)
if(ppos[x-j][0]!=-1 && ppos[x-j][0]!=code)
score[i]+=dscore(j);
else
{
int ind=(52+x-j);
if(ppos[ind][0]!=-1 && ppos[ind][0]!=code)
score[i]+=dscore(j);
}
}
}
if(score[i]>max)
{
token=i;max=score[i];
}
}
gotoxy(68,9);cout<<token+1;
return(token);
}
void player::turn()
{
int n=0,x,y,hitc,flag=0;dnum=0;
setcolor(0);setfillstyle(1,0);bar3d(461,6,634,35,0,0);
setcolor(colour[0]);settextstyle(3,0,2);outtextxy(475,5,tname);
for(int j=0;j<4;j++)
repaint(j);
do
{
roll();
if(dnum==3 && dice[2]==6)
{
settextstyle(2,0,5);setcolor(6);
outtextxy(463,115,"Sorry,");
outtextxy(465,128,"3 Sixes cancel Out..");
dnum=0;delay(1000);
}
}while(dice[dnum-1]==6 || dnum==0);
for(j=0;j<dnum;j++)
{
flag=0;setcolor(0);setfillstyle(1,0);
bar3d(461,113,634,274,0,0);
setcolor(15);rectangle(521+20*j,93,539+20*j,111);
settextstyle(2,0,5);setcolor(6);
if(movecheck(dice[j])==1)
{
do
{
settextstyle(2,0,5);setcolor(6);
outtextxy(463,112,"Select which piece(1-4)");
outtextxy(465,125,"to move : ");
if(AI)
n=decide(dice[j]);
else
{
gotoxy(68,9);cout<<" b";
cho[0]=getche();n=atoi(cho);
cout<<"b"<<cho[0];n--;
}
if(n>=0 && n<4 && gpos[n]==0 && dice[j]==6)
{
outtextxy(465,180,"Piece moved...");
move(n,1);flag=1;
}
else if(n>=0 && n<4 && movecheck(dice[j],n)==1)
{
y=gpos[n];x=calpos(y,code);
ppos[x][0]=ppos[x][1]=-1;
move(n,dice[j]);flag=1;
settextstyle(2,0,5);setcolor(6);
outtextxy(465,180,"Piece moved...");
killcheck(n);delay(500);
}
else
{
settextstyle(2,0,5);setcolor(6);
outtextxy(465,150,"Sorry, you cannot");
outtextxy(465,165,"move that piece..");
outtextxy(465,200,"Try another piece.");
delay(1000);setcolor(0);setfillstyle(1,0);
bar3d(461,113,634,274,0,0);
}
}while(flag!=1);
}
else
{
settextstyle(2,0,5);setcolor(6);
outtextxy(465,120,"No piece to move...");
outtextxy(465,140,"You have to skip");
outtextxy(465,155,"this throw....");
delay(1000);setcolor(0);setfillstyle(1,0);
bar3d(461,113,634,274,0,0);
}
setcolor(15);
line(521+20*j,93,539+20*j,111);
line(539+20*j,93,521+20*j,111);
}
int sum=gpos[0]+gpos[1]+gpos[2]+gpos[3];
if(sum==228)
typewinner();
if(sum!=228 && tnum>0)
{
setcolor(0);setfillstyle(1,0);
bar3d(461,113,634,274,0,0);settextstyle(2,0,5);
setcolor(6);outtextxy(465,120,"You get Extra Turn..");
tnum--;delay(1000);turn();
}
}
void player::repaint(int k)
{
if(gpos[k]!=0 && gpos[k]!=57)
{
setcolor(0);setfillstyle(1,colour[0]);
fillellipse(grid[gpos[k]][key],grid[gpos[k]][key+1],10,10);
setcolor(0);settextstyle(0,0,1);
char str[10];gcvt(k+1,1,str);
outtextxy(grid[gpos[k]][key]-3,grid[gpos[k]][key+1]-3,str);
}
}
void player::move(int k,int n)
{
if(n==-1)
{
setcolor(0);setfillstyle(1,0);
fillellipse(grid[gpos[k]][key],grid[gpos[k]][key+1],10,10);
setfillstyle(1,colour[0]);
fillellipse(ipos[k][key],ipos[k][key+1],10,10);
moveto(ipos[k][key]-3,ipos[k][key+1]-3);
settextstyle(0,0,1);char str[10];gcvt(k+1,1,str);
gpos[k]=0;outtext(str);delay(50);
return;
}
for(int i=gpos[k];i<=gpos[k]+n;i++)
{
setcolor(0);
if(i!=0)
{
setcolor(0);setfillstyle(1,colour[0]);
fillellipse(grid[i][key],grid[i][key+1],10,10);
moveto(grid[i][key]-3,grid[i][key+1]-3);
}
if(i==0)
{
setfillstyle(1,colour[0]);
fillellipse(ipos[k][key],ipos[k][key+1],10,10);
moveto(ipos[k][key]-3,ipos[k][key+1]-3);
}
else if(i==1)
{
setcolor(15);setfillstyle(1,15);
fillellipse(ipos[k][key],ipos[k][key+1],10,10);
}
else if(i==2)
{
setcolor(colour[0]);setfillstyle(1,colour[0]);
fillellipse(grid[1][key],grid[1][key+1],10,10);
}
else if(i==15)
{
setcolor(colour[1]);setfillstyle(1,colour[1]);
fillellipse(grid[14][key],grid[14][key+1],10,10);
}
else if(i==28)
{
setcolor(colour[2]);setfillstyle(1,colour[2]);
fillellipse(grid[27][key],grid[27][key+1],10,10);
}
else if(i==41)
{
setcolor(colour[3]);setfillstyle(1,colour[3]);
fillellipse(grid[40][key],grid[40][key+1],10,10);
}
else if(i>52)
{
setcolor(colour[0]);setfillstyle(1,colour[0]);
fillellipse(grid[i-1][key],grid[i-1][key+1],10,10);
}
else
{
setfillstyle(1,0);
fillellipse(grid[i-1][key],grid[i-1][key+1],10,10);
}
setcolor(0);settextstyle(0,0,1);
char str[10];gcvt(k+1,1,str);
outtext(str);delay(75);
}
gpos[k]+=n;drawstar();setcolor(0);
if(gpos[k]==57)
mksound();
for(int j=0;j<4;j++)
{
green.repaint(j);
red.repaint(j);
yellow.repaint(j);
blue.repaint(j);
}
}
void game()
{
for(int i=0;i<52;i++)
for(int j=0;j<2;j++)
ppos[i][j]=-1;
for(i=0;i<4;i++)
{
green.move(i,green.gpos[i]);
red.move(i,red.gpos[i]);
yellow.move(i,yellow.gpos[i]);
blue.move(i,blue.gpos[i]);
}
while((green.result+red.result+yellow.result+blue.result)!=3)
{
if(green.result!=1)
green.turn();
if(yellow.result!=1)
yellow.turn();
if(blue.result!=1)
blue.turn();
if(red.result!=1)
red.turn();
}
}
void main()
{
intro();
int gdriver = DETECT, gmode;
initgraph(&gdriver, &gmode, "");
board();game();
}
Output:
(Screenshot)
Ludo mini project in c++
Ludo mini project in c++

More Related Content

What's hot

Cg my own programs
Cg my own programsCg my own programs
Cg my own programsAmit Kapoor
 
Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentation
Prionto Abdullah
 
Rust-lang
Rust-langRust-lang
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
Abdullah Al Shiam
 
Computer Science class 12
Computer Science  class 12Computer Science  class 12
Computer Science class 12
Abhishek Sinha
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]
Daffodil International University
 
Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
Utkarsh Aggarwal
 
16. Java stacks and queues
16. Java stacks and queues16. Java stacks and queues
16. Java stacks and queues
Intro C# Book
 
Computer science-formulas
Computer science-formulasComputer science-formulas
Computer science-formulas
RAJIV GANDHI INSTITUTE OF TECHNOLOGY
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game
Pritam Samanta
 
17. Java data structures trees representation and traversal
17. Java data structures trees representation and traversal17. Java data structures trees representation and traversal
17. Java data structures trees representation and traversal
Intro C# Book
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
vineet raj
 
systems programming lab programs in c
systems programming lab programs in csystems programming lab programs in c
systems programming lab programs in cMeghna Roy
 
Fitness management application
Fitness management applicationFitness management application
Fitness management application
Rishabh Shukla
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedMike Clement
 
Online Mobile Phone Recharge
Online Mobile Phone RechargeOnline Mobile Phone Recharge
Online Mobile Phone Recharge
Suman Bose
 
project on snake game in c language
project on snake game in c languageproject on snake game in c language
project on snake game in c language
Ashutosh Kumar
 
Final project report Snake Game in Python
Final project report Snake Game in PythonFinal project report Snake Game in Python
Final project report Snake Game in Python
Muhammad Aziz
 
snake game
snake gamesnake game
snake game
Shailesh kumar
 

What's hot (20)

Cg my own programs
Cg my own programsCg my own programs
Cg my own programs
 
Tic tac toe game with graphics presentation
Tic  tac  toe game with graphics presentationTic  tac  toe game with graphics presentation
Tic tac toe game with graphics presentation
 
Rust-lang
Rust-langRust-lang
Rust-lang
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
Computer Science class 12
Computer Science  class 12Computer Science  class 12
Computer Science class 12
 
OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]OpenGL Mini Projects With Source Code [ Computer Graphics ]
OpenGL Mini Projects With Source Code [ Computer Graphics ]
 
Tic tac toe on c++ project
Tic tac toe on c++ projectTic tac toe on c++ project
Tic tac toe on c++ project
 
16. Java stacks and queues
16. Java stacks and queues16. Java stacks and queues
16. Java stacks and queues
 
Computer science-formulas
Computer science-formulasComputer science-formulas
Computer science-formulas
 
Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game Computer Project For Class XII Topic - The Snake Game
Computer Project For Class XII Topic - The Snake Game
 
Ansi c
Ansi cAnsi c
Ansi c
 
17. Java data structures trees representation and traversal
17. Java data structures trees representation and traversal17. Java data structures trees representation and traversal
17. Java data structures trees representation and traversal
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
 
systems programming lab programs in c
systems programming lab programs in csystems programming lab programs in c
systems programming lab programs in c
 
Fitness management application
Fitness management applicationFitness management application
Fitness management application
 
Bowling Game Kata in C# Adapted
Bowling Game Kata in C# AdaptedBowling Game Kata in C# Adapted
Bowling Game Kata in C# Adapted
 
Online Mobile Phone Recharge
Online Mobile Phone RechargeOnline Mobile Phone Recharge
Online Mobile Phone Recharge
 
project on snake game in c language
project on snake game in c languageproject on snake game in c language
project on snake game in c language
 
Final project report Snake Game in Python
Final project report Snake Game in PythonFinal project report Snake Game in Python
Final project report Snake Game in Python
 
snake game
snake gamesnake game
snake game
 

Similar to Ludo mini project in c++

파이썬으로 해보는 이미지 처리
파이썬으로 해보는 이미지 처리파이썬으로 해보는 이미지 처리
파이썬으로 해보는 이미지 처리
Kyunghoon Kim
 
第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)
Wataru Shito
 
C++ L04-Array+String
C++ L04-Array+StringC++ L04-Array+String
C++ L04-Array+String
Mohammad Shaker
 
Chuongtrinh led ma trix
Chuongtrinh led ma trixChuongtrinh led ma trix
Chuongtrinh led ma trix
huy hung
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
EXEM
 
Sneak preview validators 2010
Sneak preview validators 2010Sneak preview validators 2010
Sneak preview validators 2010Validators
 
第6回 関数とフロー制御
第6回 関数とフロー制御第6回 関数とフロー制御
第6回 関数とフロー制御
Wataru Shito
 
C code
C codeC code
C code
UET Taxila
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11nbb3i
 
Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
OdessaJS Conf
 
Documento de acrobat2
Documento de acrobat2Documento de acrobat2
Documento de acrobat2
fraytuck
 
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
Ji Hyung Moon
 
Can Guinness help you estimate?
Can Guinness help you estimate?Can Guinness help you estimate?
Can Guinness help you estimate?
Scrum & Kanban
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
Patrick Kettner
 
Drawing on canvas
Drawing on canvasDrawing on canvas
Drawing on canvassuitzero
 
Array matrix example programs - C language
Array matrix example programs - C languageArray matrix example programs - C language
Array matrix example programs - C language
Sk_Group
 

Similar to Ludo mini project in c++ (20)

Graphical representation of Stack
Graphical representation of StackGraphical representation of Stack
Graphical representation of Stack
 
파이썬으로 해보는 이미지 처리
파이썬으로 해보는 이미지 처리파이썬으로 해보는 이미지 처리
파이썬으로 해보는 이미지 처리
 
第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)第3回 データフレームの基本操作 その1(解答付き)
第3回 データフレームの基本操作 その1(解答付き)
 
C++ L04-Array+String
C++ L04-Array+StringC++ L04-Array+String
C++ L04-Array+String
 
Czzawk
CzzawkCzzawk
Czzawk
 
Chuongtrinh led ma trix
Chuongtrinh led ma trixChuongtrinh led ma trix
Chuongtrinh led ma trix
 
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 6회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
Sneak preview validators 2010
Sneak preview validators 2010Sneak preview validators 2010
Sneak preview validators 2010
 
第6回 関数とフロー制御
第6回 関数とフロー制御第6回 関数とフロー制御
第6回 関数とフロー制御
 
C code
C codeC code
C code
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
 
Vcs16
Vcs16Vcs16
Vcs16
 
Patrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascriptPatrick Kettner - JavaScript without javascript
Patrick Kettner - JavaScript without javascript
 
Documento de acrobat2
Documento de acrobat2Documento de acrobat2
Documento de acrobat2
 
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
(KO) 온라인 뉴스 댓글 플랫폼을 흐리는 어뷰저 분석기 / (EN) Online ...
 
Can Guinness help you estimate?
Can Guinness help you estimate?Can Guinness help you estimate?
Can Guinness help you estimate?
 
Javascript Without Javascript
Javascript Without JavascriptJavascript Without Javascript
Javascript Without Javascript
 
project3
project3project3
project3
 
Drawing on canvas
Drawing on canvasDrawing on canvas
Drawing on canvas
 
Array matrix example programs - C language
Array matrix example programs - C languageArray matrix example programs - C language
Array matrix example programs - C language
 

More from Mauryasuraj98

Image encryption using jumbling salting
Image encryption using jumbling saltingImage encryption using jumbling salting
Image encryption using jumbling salting
Mauryasuraj98
 
Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system
Mauryasuraj98
 
Movies recommendation system in R Studio, Machine learning
Movies recommendation system in  R Studio, Machine learning Movies recommendation system in  R Studio, Machine learning
Movies recommendation system in R Studio, Machine learning
Mauryasuraj98
 
Evolution of computer generation.
Evolution of computer generation. Evolution of computer generation.
Evolution of computer generation.
Mauryasuraj98
 
Case study on Intel core i3 processor.
Case study on Intel core i3 processor. Case study on Intel core i3 processor.
Case study on Intel core i3 processor.
Mauryasuraj98
 
Atm simulation mini project using Python programming language
Atm simulation  mini project using Python programming language Atm simulation  mini project using Python programming language
Atm simulation mini project using Python programming language
Mauryasuraj98
 
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT ) CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
Mauryasuraj98
 
Telephone directory using c language
Telephone directory using c languageTelephone directory using c language
Telephone directory using c language
Mauryasuraj98
 
Mini cnc plotter or printer
Mini cnc plotter or printer Mini cnc plotter or printer
Mini cnc plotter or printer
Mauryasuraj98
 
Mini Cnc Printer
Mini Cnc PrinterMini Cnc Printer
Mini Cnc Printer
Mauryasuraj98
 
E wallet
E wallet E wallet
E wallet
Mauryasuraj98
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
Mauryasuraj98
 

More from Mauryasuraj98 (12)

Image encryption using jumbling salting
Image encryption using jumbling saltingImage encryption using jumbling salting
Image encryption using jumbling salting
 
Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system Movie recommendation system using collaborative filtering system
Movie recommendation system using collaborative filtering system
 
Movies recommendation system in R Studio, Machine learning
Movies recommendation system in  R Studio, Machine learning Movies recommendation system in  R Studio, Machine learning
Movies recommendation system in R Studio, Machine learning
 
Evolution of computer generation.
Evolution of computer generation. Evolution of computer generation.
Evolution of computer generation.
 
Case study on Intel core i3 processor.
Case study on Intel core i3 processor. Case study on Intel core i3 processor.
Case study on Intel core i3 processor.
 
Atm simulation mini project using Python programming language
Atm simulation  mini project using Python programming language Atm simulation  mini project using Python programming language
Atm simulation mini project using Python programming language
 
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT ) CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
CAR PARKING SYSTEM USING VISUAL STUDIO C++ (OPERATING SYSTEM MINI PROJECT )
 
Telephone directory using c language
Telephone directory using c languageTelephone directory using c language
Telephone directory using c language
 
Mini cnc plotter or printer
Mini cnc plotter or printer Mini cnc plotter or printer
Mini cnc plotter or printer
 
Mini Cnc Printer
Mini Cnc PrinterMini Cnc Printer
Mini Cnc Printer
 
E wallet
E wallet E wallet
E wallet
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
 

Recently uploaded

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 

Recently uploaded (20)

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 

Ludo mini project in c++

  • 1. Name: Suraj R. Maurya Course: CO3G Batch: X Roll.no: 162218 6 : MINI PROJECT Aim: Professional Ludus.(Using C++) Source code: #include<graphics.h> #include<fstream.h> #include<string.h> #include<stdlib.h> #include<limits.h> #include<ctype.h> #include<conio.h> #include<stdio.h> #include<dos.h> int ppos[53][2],wincount=0,win[4]={0,0,0,0},seed=0; int safepos[8]={1,9,14,22,27,35,40,48}; int ipos[4][8]={ 65,125, 335, 65, 395,335, 125,395, 65, 65, 395, 65, 335,395, 65,395, 125, 65, 335,125, 335,335, 125,335, 125,125, 395,125, 395,395, 65,335, }; int grid[58][8]={ 65,125, 335, 65, 395,335, 125,395, 50,200, 260, 50, 410,260, 200,410, 80,200, 260, 80, 380,260, 200,380, 110,200, 260,110, 350,260, 200,350, 140,200, 260,140, 320,260, 200,320, 170,200, 260,170, 290,260, 200,290, 200,170, 290,200, 260,290, 170,260, 200,140, 320,200, 260,320, 140,260, 200,110, 350,200, 260,350, 110,260, 200, 80, 380,200, 260,380, 80,260, 200, 50, 410,200, 260,410, 50,260, 200, 20, 440,200, 260,440, 20,260, 230, 20, 440,230, 230,440, 20,230, 260, 20, 440,260, 200,440, 20,200, 260, 50, 410,260, 200,410, 50,200, 260, 80, 380,260, 200,380, 80,200, 260,110, 350,260, 200,350, 110,200, 260,140, 320,260, 200,320, 140,200, 260,170, 290,260, 200,290, 170,200, 290,200, 260,290, 170,260, 200,170, 320,200, 260,320, 140,260, 200,140, 350,200, 260,350, 110,260, 200,110, 380,200, 260,380, 80,260, 200, 80, 410,200, 260,410, 50,260, 200, 50, 440,200, 260,440, 20,260, 200, 20, 440,230, 230,440, 20,230, 230, 20, 440,260, 200,440, 20,200, 260, 20, 410,260, 200,410, 50,200, 260, 50, 380,260, 200,380, 80,200, 260, 80, 350,260, 200,350, 110,200, 260,110, 320,260, 200,320, 140,200, 260,140, 290,260, 200,290, 170,200, 260,170, 260,290, 170,260, 200,170, 290,200, 260,320, 140,260, 200,140, 320,200, 260,350, 110,260, 200,110, 350,200, 260,380, 80,260, 200, 80, 380,200, 260,410, 50,260, 200, 50, 410,200, 260,440, 20,260, 200, 20, 440,200, 230,440, 20,230, 230, 20, 440,230, 200,440, 20,200, 260, 20, 440,260, 200,410, 50,200, 260, 50, 410,260, 200,380, 80,200, 260, 80, 380,260, 200,350, 110,200, 260,110, 350,260, 200,320, 140,200, 260,140, 320,260, 200,290, 170,200, 260,170, 290,260, 170,260, 200,170, 290,200, 260,290,
  • 2. 140,260, 200,140, 320,200, 260,320, 110,260, 200,110, 350,200, 260,350, 80,260, 200, 80, 380,200, 260,380, 50,260, 200, 50, 410,200, 260,410, 20,260, 200, 20, 440,200, 260,440, 20,230, 230, 20, 440,230, 230,440, 50,230, 230, 50, 410,230, 230,410, 80,230, 230, 80, 380,230, 230,380, 110,230, 230,110, 350,230, 230,350, 140,230, 230,140, 320,230, 230,320, 170,230, 230,170, 290,230, 230,290, 210,230, 230,200, 260,230, 230,260, }; int st1a[]={200, 67,189, 87,211, 87},st1b[]={189, 73,200, 93,211, 73}; int st2a[]={380,187,369,207,391,207},st2b[]={369,193,380,213,391,193}; int st3a[]={260,367,249,387,271,387},st3b[]={249,373,260,393,271,373}; int st4a[]={ 80,247, 69,267, 91,267},st4b[]={ 69,253, 80,273, 91,253}; class player { int colour[4],key,code,dice[4],dnum,tnum,AI; int calpos(int,int); int decide(int); int dscore(int); int movecheck(int,int); void roll(); void show(int); void killcheck(int); int stchk(int); void repaint(int); void typewinner(); void mksound() { sound(1500);delay(55); nosound();tnum++; } public: char name[20],cho[5],tname[20]; int gpos[4],result; void turn(); void move(int,int); void pinit(int a,int b,int c,int d,int y,char pname[],int ai) { gpos[0]=gpos[1]=gpos[2]=gpos[3]=dnum=tnum=0; colour[0]=a;colour[1]=b;colour[2]=c;colour[3]=d; key=y;result=0;AI=ai;code=key/2;strcpy(name,pname); strcat(tname,name);strcat(tname,"'s Turn"); } }; player green,yellow,blue,red; int player::stchk(int d) { for(int k=0;k<8;k++) { int dis=d-safepos[k]; if(dis==0) return(1); else if(dis<0)
  • 3. return(0); } return(0); } int player::dscore(int d) { if(d>=1 && d<=6) return(2); else if(d>=7 && d<=12) return(1); else return(0); } int player::calpos(int position, int pcode) { switch(pcode) { case 0:return(position-1); case 1:return((position+12)%52); case 2:return((position+25)%52); case 3:return((position+38)%52); } return(0); } void box() { textcolor(1);gotoxy(3,2);putch(201); for(int i=4;i<=77;i++) putch(205); putch(187); for(i=3;i<=23;i++) { gotoxy(78,i);putch(186); } gotoxy(78,24);putch(188); for(i=77;i>=4;i--) { gotoxy(i,24);putch(205); } gotoxy(3,24);putch(200); for(i=23;i>=3;i--) { gotoxy(3,i);putch(186); } } void intro() { clrscr();box(); char name[20],ch; textcolor(6); gotoxy(21,3);cputs("____________________________________");
  • 4. gotoxy(22,4);cputs("Welcome to Professional LUDUS v1.0"); gotoxy(21,5);cputs("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); textcolor(2); gotoxy(10,7);cputs("GREEN PLAYER"); gotoxy(15,8);cputs("Enter Name:");gets(name); gotoxy(15,9);cputs("Computer Controlled? (y/n):");ch=getche(); if(toupper(ch)=='Y') green.pinit(2,14,9,4,0,name,1); else green.pinit(2,14,9,4,0,name,0); textcolor(14); gotoxy(10,11);cputs("YELLOW PLAYER"); gotoxy(15,12);cputs("Enter Name:");gets(name); gotoxy(15,13);cputs("Computer Controlled? (y/n):");ch=getche(); if(toupper(ch)=='Y') yellow.pinit(14,9,4,2,2,name,1); else yellow.pinit(14,9,4,2,2,name,0); textcolor(9); gotoxy(10,15);cputs("BLUE PLAYER"); gotoxy(15,16);cputs("Enter Name:");gets(name); gotoxy(15,17);cputs("Computer Controlled? (y/n):");ch=getche(); if(toupper(ch)=='Y') blue.pinit(9,4,2,14,4,name,1); else blue.pinit(9,4,2,14,4,name,0); textcolor(4); gotoxy(10,19);cputs("RED PLAYER"); gotoxy(15,20);cputs("Enter Name:");gets(name); gotoxy(15,21);cputs("Computer Controlled? (y/n):");ch=getche(); if(toupper(ch)=='Y') red.pinit(4,2,14,9,6,name,1); else red.pinit(4,2,14,9,6,name,0); delay(100); } void quit() { cleardevice();closegraph(); clrscr();box();textcolor(4); gotoxy(20,11);cputs("*************************************n"); gotoxy(20,12);cputs("Thank you for using this software....n"); gotoxy(20,13);cputs("*************************************n"); delay(2000); for(int i=23;i>=7;i-=1) { clrscr();box();textcolor(14); gotoxy(32,5);cputs("CREDITS"); gotoxy(32,6);cputs("~~~~~~~"); if(i<24) {
  • 5. gotoxy(23,i); cputs("Professional LUDUS "); } if(i<23) { gotoxy(22,1+i); cputs("~~~~~~~~~~~~~~~~~~~~~~~~~~"); } if(i<21) { gotoxy(22,3+i); cputs("Concept & Coding : Suraj"); } if(i<20) { gotoxy(22,4+i); cputs("Design & Graphics : Suraj"); } if(i<19) { gotoxy(22,5+i); cputs("Supervisor : Suraj"); } if(i<18) { gotoxy(22,6+i); cputs("Language : Borland Turbo C++"); } if(i<16) { gotoxy(10,8+i);cputs("This software is protected by "); cputs("international rights and policies."); } if(i<14) { gotoxy(10,10+i);cputs("Reproduction without "); cputs("permission is punishable under law."); } delay(100); } delay(2000);getch(); exit(0); } void drawstar() { setcolor(2);setfillstyle(1,2);fillpoly(3,st1a);fillpoly(3,st1b); setcolor(14);setfillstyle(1,14);fillpoly(3,st2a);fillpoly(3,st2b); setcolor(9);setfillstyle(1,9);fillpoly(3,st3a);fillpoly(3,st3b); setcolor(4);setfillstyle(1,4);fillpoly(3,st4a);fillpoly(3,st4b); }
  • 6. void board() { char str[100]={"Professional LUDUS "}; setcolor(2);settextstyle(1,0,2); outtextxy(115,455,str); strcpy(str,"Made By - Suraj"); setcolor(14);settextstyle(2,0,5); outtextxy(420,465,str); int ar1[]={185,185,230,230,185,275}; int ar2[]={185,185,230,230,275,185}; int ar3[]={275,185,230,230,275,275}; setcolor(15); setfillstyle(1,2);bar3d(35,185,65,245,0,0);bar3d(65,215,185,245,0,0); setfillstyle(1,14);bar3d(215,35,275,65,0,0);bar3d(215,65,245,185,0,0); setfillstyle(1,4);bar3d(215,275,245,395,0,0);bar3d(185,395,245,425,0,0); setfillstyle(1,9);bar3d(275,215,395,245,0,0);bar3d(395,215,425,275,0,0); for(int i=5;i<=455;i+=30) { line(5,i,455,i);line(i,5,i,455); } setfillstyle(1,2);bar3d(5,5,185,185,0,0); setfillstyle(1,15);bar3d(35,35,155,155,0,0); setcolor(2); setlinestyle(1,1,3); circle(65,65,14);circle(65,125,14); circle(125,65,14);circle(125,125,14); setlinestyle(0,0,1);setcolor(15); setfillstyle(1,14);bar3d(275,5,455,185,0,0); setfillstyle(1,15);bar3d(305,35,425,155,0,0); setcolor(14); setlinestyle(1,1,3); circle(335,65,14);circle(395,65,14); circle(335,125,14);circle(395,125,14); setlinestyle(0,0,1);setcolor(15); setfillstyle(1,4);bar3d(5,275,185,455,0,0); setfillstyle(1,15);bar3d(35,305,155,425,0,0); setcolor(4); setlinestyle(1,1,3); circle(65,335,14);circle(65,395,14); circle(125,335,14);circle(125,395,14); setlinestyle(0,0,1);setcolor(15); setfillstyle(1,9);bar3d(275,275,455,455,0,0); setfillstyle(1,15);bar3d(305,305,425,425,0,0); setcolor(9); setlinestyle(1,1,3); circle(335,335,14);circle(335,395,14); circle(395,335,14);circle(395,395,14); setlinestyle(0,0,1);setcolor(15); setfillstyle(1,4);bar3d(185,185,275,275,0,0); setfillstyle(1,2);fillpoly(3,ar1); setfillstyle(1,14);fillpoly(3,ar2);
  • 7. setfillstyle(1,9);fillpoly(3,ar3); drawstar();setcolor(6);setfillstyle(1,0); bar3d(460,5,635,275,0,0); bar3d(460,280,635,375,0,0); bar3d(460,380,635,455,0,0); bar3d(520,92,540,112,0,0); bar3d(540,92,560,112,0,0); bar3d(560,92,580,112,0,0); settextstyle(2,0,5); outtextxy(467,285,"Winner:"); outtextxy(465,305,"2nd :"); outtextxy(465,325,"3rd :"); outtextxy(465,345,"Loser :"); outtextxy(465,380,"To EXIT press 'q'"); outtextxy(465,395,"in between the turns..."); outtextxy(465,420,"Email Suggestions at :"); outtextxy(465,435,"nkrsharma@gmail.com"); } void player::typewinner() { result=1;wincount++;win[code]=1; setcolor(colour[0]);settextstyle(2,0,5); switch(wincount) { case 1: outtextxy(520,285,name);break; case 2: outtextxy(520,305,name);break; case 3: { outtextxy(520,325,name); for(int i=0;i<4;i++) if(win[i]==0) switch(i) { case 0: green.typewinner(); case 1: yellow.typewinner(); case 2: blue.typewinner(); case 3: red.typewinner(); } break; } case 4: { outtextxy(520,345,name); getch();quit(); } } } void player::show(int n) { setcolor(0);setfillstyle(1,15); bar3d(530,50,570,90,0,0);
  • 8. switch(n) { case 1: { setfillstyle(1,0); fillellipse(550,70,4,4); break; } case 2: { setfillstyle(1,0); fillellipse(540,60,4,4); fillellipse(560,80,4,4); break; } case 3: { setfillstyle(1,0); fillellipse(560,60,4,4); fillellipse(550,70,4,4); fillellipse(540,80,4,4); break; } case 4: { setfillstyle(1,0); fillellipse(540,60,4,4); fillellipse(540,80,4,4); fillellipse(560,60,4,4); fillellipse(560,80,4,4); break; } case 5: { setfillstyle(1,0); fillellipse(540,60,4,4); fillellipse(540,80,4,4); fillellipse(560,60,4,4); fillellipse(560,80,4,4); fillellipse(550,70,4,4); break; } case 6: { setfillstyle(1,0); fillellipse(540,60,4,4); fillellipse(540,70,4,4); fillellipse(540,80,4,4); fillellipse(560,60,4,4); fillellipse(560,70,4,4); fillellipse(560,80,4,4);
  • 9. } } } void player::killcheck(int num) { int z=gpos[num],x=calpos(z,code),hitc,hitn; if(z<=51 && stchk(z)==0) { hitc=ppos[x][0];hitn=ppos[x][1]; ppos[x][0]=code;ppos[x][1]=num; if(hitc!=-1) { switch(hitc) { case 0:green.move(hitn,-1);break; case 1:yellow.move(hitn,-1);break; case 2:blue.move(hitn,-1);break; case 3:red.move(hitn,-1);break; } repaint(num);mksound(); } } } int player::movecheck(int d,int num=-1) { if(num==-1) { for(int i=0;i<4;i++) { if(gpos[i]==0 && d==6) return(1); if(gpos[i]!=0 && (gpos[i]+d)<=57) { int flag1=1; for(int l=0;l<4;l++) if(gpos[i]+d==gpos[l] && stchk(gpos[l])!=1) if(gpos[l]!=57) flag1=0; if(flag1) return(1); } } } else { if(gpos[num]==0 && d==6) return(1); if(gpos[num]!=0 && (gpos[num]+d)<=57) { for(int l=0;l<4;l++) if(gpos[num]+d==gpos[l] && stchk(gpos[l])!=1)
  • 10. if(gpos[l]!=57) return(0); return(1); } } return(0); } void player::roll() { char ch,str[10]; setcolor(0);setfillstyle(1,0);bar3d(461,113,634,274,0,0); setcolor(6);setfillstyle(1,0); randomize(); if(dnum==0) for(int i=0;i<3;i++) bar3d(520+20*i,92,540+20*i,112,0,0); settextstyle(2,0,5);outtextxy(480,30, "Hit any key to Roll."); setcolor(0); if(!AI) { do { dice[dnum]=random(6)+1; show(dice[dnum]);delay(25); }while(!kbhit()); ch=getche(); //if(ch>='i' && ch<='n') //{ // show(ch-104);dice[dnum]=ch-104; //} if(toupper(ch)=='Q') quit(); } else { int stopper=(seed*2)%20+20; for(int i=0;i<stopper;i++) { dice[dnum]=random(6)+1; show(dice[dnum]);delay(25); } } setcolor(6);gcvt(dice[dnum],1,str); settextstyle(4,0,1);outtextxy(526+dnum*20,89,str); dnum++;seed++; } int player::decide(int dic) { int score[4]={0,0,0,0},a,b,x,y,dist,max,token; max=INT_MIN;token=-1; for(int i=0;i<4;i++)
  • 11. { a=gpos[i];b=a+dic; x=calpos(a,code);y=calpos(b,code); if(movecheck(dic,i)==0) //position on board score[i]-=100; if(a==0 && dic==6) score[i]+=7; if(a>45 && a<52) score[i]+=5; else if(a>40 && a<52) score[i]+=3; else if(a>27) score[i]+=1; if(b==57) score[i]+=2; if(ppos[y][0]!=-1 && ppos[y][0]!=code && a<51) //attack score[i]+=10; if((a<51 && b>51) || stchk(b)==1) //future position score[i]+=3; if(movecheck(dic,i)==1 && b<52) { for(int j=1;j<13;j++) //look enemy behind { if((y-j)>=0) if(ppos[y-j][0]!=-1 && ppos[y-j][0]!=code) score[i]-=dscore(j); else { int ind=(52+y-j); if(ppos[ind][0]!=-1 && ppos[ind][0]!=code) score[i]-=dscore(j); } } for(j=1;j<13;j++) //look enemy infront { if((y+j)<=51) if(ppos[y+j][0]!=-1 && ppos[y+j][0]!=code) score[i]+=dscore(j); else { int ind=(y+j-52); if(ppos[ind][0]!=-1 && ppos[ind][0]!=code) score[i]+=dscore(j); } } } if(a>51 || stchk(a)==1) //current position score[i]-=4; if(movecheck(dic,i)==1 && a<52) { for(int j=1;j<13;j++) //look enemy behind
  • 12. { if((x-j)>=0) if(ppos[x-j][0]!=-1 && ppos[x-j][0]!=code) score[i]+=dscore(j); else { int ind=(52+x-j); if(ppos[ind][0]!=-1 && ppos[ind][0]!=code) score[i]+=dscore(j); } } } if(score[i]>max) { token=i;max=score[i]; } } gotoxy(68,9);cout<<token+1; return(token); } void player::turn() { int n=0,x,y,hitc,flag=0;dnum=0; setcolor(0);setfillstyle(1,0);bar3d(461,6,634,35,0,0); setcolor(colour[0]);settextstyle(3,0,2);outtextxy(475,5,tname); for(int j=0;j<4;j++) repaint(j); do { roll(); if(dnum==3 && dice[2]==6) { settextstyle(2,0,5);setcolor(6); outtextxy(463,115,"Sorry,"); outtextxy(465,128,"3 Sixes cancel Out.."); dnum=0;delay(1000); } }while(dice[dnum-1]==6 || dnum==0); for(j=0;j<dnum;j++) { flag=0;setcolor(0);setfillstyle(1,0); bar3d(461,113,634,274,0,0); setcolor(15);rectangle(521+20*j,93,539+20*j,111); settextstyle(2,0,5);setcolor(6); if(movecheck(dice[j])==1) { do { settextstyle(2,0,5);setcolor(6); outtextxy(463,112,"Select which piece(1-4)"); outtextxy(465,125,"to move : ");
  • 13. if(AI) n=decide(dice[j]); else { gotoxy(68,9);cout<<" b"; cho[0]=getche();n=atoi(cho); cout<<"b"<<cho[0];n--; } if(n>=0 && n<4 && gpos[n]==0 && dice[j]==6) { outtextxy(465,180,"Piece moved..."); move(n,1);flag=1; } else if(n>=0 && n<4 && movecheck(dice[j],n)==1) { y=gpos[n];x=calpos(y,code); ppos[x][0]=ppos[x][1]=-1; move(n,dice[j]);flag=1; settextstyle(2,0,5);setcolor(6); outtextxy(465,180,"Piece moved..."); killcheck(n);delay(500); } else { settextstyle(2,0,5);setcolor(6); outtextxy(465,150,"Sorry, you cannot"); outtextxy(465,165,"move that piece.."); outtextxy(465,200,"Try another piece."); delay(1000);setcolor(0);setfillstyle(1,0); bar3d(461,113,634,274,0,0); } }while(flag!=1); } else { settextstyle(2,0,5);setcolor(6); outtextxy(465,120,"No piece to move..."); outtextxy(465,140,"You have to skip"); outtextxy(465,155,"this throw...."); delay(1000);setcolor(0);setfillstyle(1,0); bar3d(461,113,634,274,0,0); } setcolor(15); line(521+20*j,93,539+20*j,111); line(539+20*j,93,521+20*j,111); } int sum=gpos[0]+gpos[1]+gpos[2]+gpos[3]; if(sum==228) typewinner(); if(sum!=228 && tnum>0) {
  • 14. setcolor(0);setfillstyle(1,0); bar3d(461,113,634,274,0,0);settextstyle(2,0,5); setcolor(6);outtextxy(465,120,"You get Extra Turn.."); tnum--;delay(1000);turn(); } } void player::repaint(int k) { if(gpos[k]!=0 && gpos[k]!=57) { setcolor(0);setfillstyle(1,colour[0]); fillellipse(grid[gpos[k]][key],grid[gpos[k]][key+1],10,10); setcolor(0);settextstyle(0,0,1); char str[10];gcvt(k+1,1,str); outtextxy(grid[gpos[k]][key]-3,grid[gpos[k]][key+1]-3,str); } } void player::move(int k,int n) { if(n==-1) { setcolor(0);setfillstyle(1,0); fillellipse(grid[gpos[k]][key],grid[gpos[k]][key+1],10,10); setfillstyle(1,colour[0]); fillellipse(ipos[k][key],ipos[k][key+1],10,10); moveto(ipos[k][key]-3,ipos[k][key+1]-3); settextstyle(0,0,1);char str[10];gcvt(k+1,1,str); gpos[k]=0;outtext(str);delay(50); return; } for(int i=gpos[k];i<=gpos[k]+n;i++) { setcolor(0); if(i!=0) { setcolor(0);setfillstyle(1,colour[0]); fillellipse(grid[i][key],grid[i][key+1],10,10); moveto(grid[i][key]-3,grid[i][key+1]-3); } if(i==0) { setfillstyle(1,colour[0]); fillellipse(ipos[k][key],ipos[k][key+1],10,10); moveto(ipos[k][key]-3,ipos[k][key+1]-3); } else if(i==1) { setcolor(15);setfillstyle(1,15); fillellipse(ipos[k][key],ipos[k][key+1],10,10); } else if(i==2)
  • 15. { setcolor(colour[0]);setfillstyle(1,colour[0]); fillellipse(grid[1][key],grid[1][key+1],10,10); } else if(i==15) { setcolor(colour[1]);setfillstyle(1,colour[1]); fillellipse(grid[14][key],grid[14][key+1],10,10); } else if(i==28) { setcolor(colour[2]);setfillstyle(1,colour[2]); fillellipse(grid[27][key],grid[27][key+1],10,10); } else if(i==41) { setcolor(colour[3]);setfillstyle(1,colour[3]); fillellipse(grid[40][key],grid[40][key+1],10,10); } else if(i>52) { setcolor(colour[0]);setfillstyle(1,colour[0]); fillellipse(grid[i-1][key],grid[i-1][key+1],10,10); } else { setfillstyle(1,0); fillellipse(grid[i-1][key],grid[i-1][key+1],10,10); } setcolor(0);settextstyle(0,0,1); char str[10];gcvt(k+1,1,str); outtext(str);delay(75); } gpos[k]+=n;drawstar();setcolor(0); if(gpos[k]==57) mksound(); for(int j=0;j<4;j++) { green.repaint(j); red.repaint(j); yellow.repaint(j); blue.repaint(j); } } void game() { for(int i=0;i<52;i++) for(int j=0;j<2;j++) ppos[i][j]=-1; for(i=0;i<4;i++) {