Hi...
I'm currently doing a ludo game in C, I'm stuck with the pawn positions on the board. How do I manage the position of the pawns of each player, if I have maximum of two players and 4 pawns?

Here is my code for the pawn position but it is not working.

void position()                          //Function of pawn position
{
int original_position,updated_position,b,outcome;
char pawns[]={0};
original_position=0;
updated_position=0;
int i,numplayer,pawn,base;
     
  
while ((original_position<=56)&& (updated_position<=56))

b=1;
pawns[b]=original_position;
for(i=0;i<numplayer;i++)
{ 
printf("\n\n Player %d",i+1);
printf("\nCurrent position is = %d\n",original_position);
updated_position=original_position+outcome;
printf("\nNew position is = %d\n",updated_position);
rolldice();
{
if(original_position=updated_position)
{
printf("Pawn return to base");
base++;
pawn--;

}
if(original_position=56)
{
printf("Congrats you've nearly there!");
pawn--;
base--;
}
else if(pawn=4)
{
printf("Congrats you have won!");

}
}

Reason: add code tags

Can you be more explicit please...
Or may be give me an example...
Thanks.

This article has been dead for over six months. Start a new discussion instead.