السلام عليكم ورحمة الله وبركاته
انا كتبت كود كامل ولله الحمد وبإذن الله سيعمل
للعبه الـ checkers
لم يظهر لي اي اخطاء
ولكن في وقت التشغيل run time يظهر لي خطأ لا اعلم ماهو
#include<iostream>
using namespace std;
#ifndef board_h
#define board_h
class board
{
protected :
const int state_black;
const int state_white ;
const int state_board_m ;
const int state_board_im ;
const int state_black_k ;
const int state_white_k; // shows states of pieces on board // ( white, white_king, black, black_king and the board surface )
int arr[8][8]; // 8 x 8 state type array it takes values : (black,white,board)
public :
board () ;
board (int state_b , int state_w , int state_b_m , int state_bo_i ,int state_b_k , int state_w_k )
:state_black (state_b), state_white(state_w), state_board_m (state_b_m), state_board_im (state_bo_i), state_black_k(state_b_k),
state_white_k (state_w_k)
{
int i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 2; j++) {
arr[j];
}
}
}
char fun_piece_wk() // function to return white piece .
{
return 'W';
}
char fun_piece_bk() // function to return black_king piece .
{
return 'B';
}
char fun_piece_w() // function to return white piece .
{
return 'w';
}
char fun_piece_b() // function to return black piece .
{
return 'b';
}
char fun_board_m() // function to return checker movable board places .
{
return '_';
}
char fun_board_im() // function to show checker immovable board places .
{
return ' ';
}
void king_check() // transforms white checker to white king
{
for(int i=0;i<1;i++)
for(int j=0;j<8;j++)
if(arr[j]==state_white)
{
arr[j]= state_white_k;
}
}
void b_king_check() // transforms black checker to black king
{
for(int i=7;i<8;i++)
for(int j=0;j<8;j++)
if(arr[j]==state_black)
{
arr[j]=state_black_k;
}
}
void print()
{
cout<<" 0 1 2 3 4 5 6 7 "<< endl<< endl<< endl; // No of columns
for(int m=0;m<8;m++) // loop to call functions to print pieces
{
cout<<" "<<m<<" "; // No of rows
for(int n=0;n<8;n++)
{
if(arr[m][n]== state_white)
{
cout<<fun_piece_w()<<" "; // calling function to print white piece == "w"
}
else if (arr[m][n]== state_black)
{
cout<<fun_piece_b()<<" "; // calling function to print black piece == "b"
}
else if (arr[m][n]== state_white_k)
{
cout<<fun_piece_wk()<<" "; // calling function to print white king piece == "W"
}
else if (arr[m][n]== state_black_k)
{
cout<<fun_piece_bk()<<" "; // calling function to print black king piece == "B"
}
else if (arr[m][n]==state_board_m)
{
cout<<fun_board_m()<<" "; // calling function to print board == "_" to show board places where checkers can move
}
else
cout<<fun_board_im()<<" "; // calling function to print board == " " to show board places where checkers cannot move
}
cout << endl<< endl<< endl;
}
cout<< endl<<" ================================="<< endl<< endl;
}
};
#endif
//---------------------------------------------------------------
#include <iostream>
using namespace std ;
#ifndef move_h
#define move_h
class move : public board
{
private :
int mf_row,mf_column,bmf_row,bmf_column; // Move from
int mt_row,mt_column,bmt_row,bmt_column; // Move to
public :
move () : board ()
{
mf_row = 0 ;
mf_column = 0 ;
bmf_row = 0 ;
bmf_column = 0 ;
mt_row = 0 ;
mt_column = 0 ;
bmt_row= 0 ;
bmt_column = 0 ;
}
move ( int mf_r,int mf_c,int bmf_r,int bmf_c ,int mt_r, int mt_c, int bmt_r,int bmt_c ) : board ()
{
mf_row = mf_r ;
mf_column = mf_c ;
bmf_row = bmf_r ;
bmf_column = bmf_c ;
mt_row = mt_r ;
mt_column = mt_c ;
bmt_row= bmt_r ;
bmt_column = bmt_c ;
}
};
#endif
// ------------------------------------------------------------------
#include<iostream>
#include "board.h"
#include "move.h"
using namespace std;
int main ()
{l ;
move v ;
v.moveit ();
return 0;
}رجوا مساعدتي جزاكم الله عني خير الجزاء وفرج هم من اعانني فيه وجعله في ميزان حسناته
لا اسامح من ياخذ هذا الكود وينسبه لنفسه ( بلا إذن مني ) فقد بذلت على هذا المشروع مجهودا متعبا :(
شكرا لكم




