hi, it's me again, uhm i have this program for bantumi game, this program is running, but there are some problems i am encountering whenever i execute it.. hope you understand my program..

``````//this is a two player bantumi game,the user will enter the position in the board game to start

#include<stdio.h>
#include<conio.h>
int d1=0,d2=0,p1[]={7,7,7,7,7,7,7},p2[]={7,7,7,7,7,7,7},B2=0,B1=0,i,j,n,turn=1,posi;

void player1()
{for(i=n;i>0;i--)
{if(posi<7)
{p1[posi]+=1;
if(p1[posi]-1==0&&i-1==0)
{B1+=1;
B1+=p2[posi]+p1[posi];
p2[posi]=0;
i=0;turn++;
}
++posi;
}

else if(posi==7)
{B1+=1;
posi++;
}

else
{p2[j]+=1;
j-=1;
if(j<0&&i>0)
{B2+=1;
posi=0;
}
}
}
}

void player2()
{for(i=n;i>0;i--)
{if(posi>=0)
{p2[posi]+=1;
if(p1[posi]+1==0&&i-1==0)
{B2+=1;
B2+=p2[posi]+p1[posi];
p1[posi]=0;
i=0;turn++;
}
posi--;
}

else if(posi==-1)
{B2+=1;
posi--;
}

else
{p1[j]+=1;
j+=1;
if(j>6&&i>0)
{B1+=1;
posi=6;
}
}
}
}

int decision(int d)
{ d=0;
for(i=0;i<7;i++)
{if(p1[i]==0)
d1+=1;
if(p2[i]==0)
d2+=1;
}

if(d1==7||d2==7)
{B2+=p2[0]+p2[1]+p2[2]+p2[3]+p2[4]+p2[5]+p2[6];
B1+=p1[0]+p1[1]+p1[2]+p1[3]+p1[4]+p1[5]+p1[6];

if(B1>B2)
printf("player 1 wins");
else if(B2>B1)
printf("player 2 wins");
else printf("Draw Game");
d+=1;
}
return d;
}

void gameboard()
{gotoxy(10,1);
printf("[%d] [%d] [%d] [%d] [%d] [%d] [%d]",p2[0],p2[1],p2[2],p2[3],p2[4],p2[5],p2[6]);
gotoxy(8,3);
printf("[%d]",B2);
gotoxy(38,3);printf("[%d]",B1);
gotoxy(10,5);
printf("[%d] [%d] [%d] [%d] [%d] [%d] [%d]",p1[0],p1[1],p1[2],p1[3],p1[4],p1[5],p1[6]);
}

void main()
{int d=0;//this variable determines if the game is over or not
clrscr();
do{
clrscr();gameboard();
gotoxy(10,15);
printf("Enter position: ");
scanf("%d",&posi);
posi-=1;if(posi>0&&posi<6){
if(turn%2!=0)
{gotoxy(10,3);
printf("Player 1");
n=p1[posi];
j=6;
p1[posi]=0;
++posi;
player1();
}
else
{gotoxy(10,3);
printf("Player 2");j=0;
n=p2[posi]=0;++posi;
player2();
}}
decision(d);
}while(d<1);
getch();
}``````

..thanks to those who will reply immediately..
-Taichou;)

I hope your not from PUP... :D
hehehe....

an freshmen it STUDENT...

:d

commented: As random and irrelevant as it can get. +0

hahaha,,, ikaw pala yan CARL...

:D peace....

ahahaha....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.