4. IMPLEMENTATION (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,
230,440, 20,230, 230, 20, 440,230, 200,440, 20,200, 260, 20, 440,260,
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:
}
gotoxy(78,24);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);
}
}