473,399 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

game checkers : function rulls .

1
Hi everybody. I've recently written a code for the function rulls in the game ckeckers but it has one error which is a syntax error and I cannot fix it . I will appreciate any help with my code. Thanks.
#include <stdio.h>
#include <stdlib.h>
int board[8][8]={0,2,0,2,0,2,0,2,2,0,2,0,2,0,2,0,0,2,0,2,0,2,0,2, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0, 1,0,1,0,1,0,1,1,0,1,0,1,0,1,0};
int rulls_home(int a1,int b1, int a2, int b2);
int main(){
{
int x1,x2,y1,y2;
scanf("%d",&x1);
scanf("%d",&y1);
scanf("%d",&x2);
scanf("%d",&y2);
printf("%d",rulls_home(x1,y1,x2,y2));
system("PAUSE");
return 0;
}
int rulls_home(int a1,int b1, int a2, int b2){
int turn,i,j;

scanf("%d",&turn);

for(i=0;i<=7;i++){
for(j=0;j<=7;j++){
if((i%2==0&&j%2==0)||((i-1)%2==0&&(j-1)%2==0)){

if(board[i][j]==board[a2][b2]){
return 0;
}

}


}

}



if(turn==0){
if(a1<=7&&a2<=7){
if(b1<=7&&b2<=7){
if(board[a1][b1]==1||board[a1][b1]==3){
if(board[a2][b2]==0){
return 1;
}
return 0;
}
return 0;
}
return 0;
}


return 0;
}

else{
if(turn==1){
if(a1<=7&&a2<=7){
if(b1<=7&&b2<=7){
if(board[a1][b1]==2||board[a2][b2]==4){
if(board[a2][b2]==0){
return 1;
}
return 0;
}
return 0;
}
return 0;
}
return 0;

}}
}
Jan 20 '12 #1
1 1900
Rabbit
12,516 Expert Mod 8TB
It would help to have the error text and line number.
Jan 20 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: swint002 | last post by:
Stored procedure that allows you to play checkers in sql query analyzer. http://www.geocities.com/swint002/checkers.txt Let me know what you think. Enjoy.
3
by: swint002 | last post by:
Here's a checkers game written in T-SQL that you can play in the sql query analyzer. http://www.geocities.com/swint002/checkers.txt Enjoy :-)
2
by: me | last post by:
hey all, I want to make a 4 on a row game (you know the red and yellow or blue round coins that you put in a empty square with holes and the first 4 on a row is the winner) i thougth on many...
5
by: A_StClaire_ | last post by:
annoying one. can anyone spot the issue? it appears communityCards can't be accessed via my static function but I don't know why... Game.h: #pragma once #include <vector> #include...
8
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided...
1
by: fowle040 | last post by:
I underlined and bold print my files. I need to know how to make this code into a working game. The object of the game is to have two players 1- belle and 2-beast. I want them to lose and gain...
0
by: 2Barter.net | last post by:
Thank you Checkers for trying to let the Cat out of the Bag http://www.goenglish.com/GoEnglish_com_1LetTheCatOutOfTheBag.gif 21 feb 2007 --CHECKERS Daytona Beach Florida 24 oct 2006 Thank you...
3
by: shrumichaela | last post by:
i am trying to write a simple program that allows players to start a new game of draughts, store the status of the game and allow players to make moves...can anyone please give me tips on how to get...
4
by: Hypnotik | last post by:
So I'm writing this program. I have the board constructed, and I'm having a problem making a move. At this point I just want to make a move, I'll work on whether it is a legal move after that. The...
0
by: przemek | last post by:
Writing a simple checkers game I can't decide: - to implement a pawn as a windows control communicating with the future game engine and paint a passive "wallpaper" board, - to make a board of 64...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.