473,385 Members | 1,343 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,385 software developers and data experts.

Checkers board game program

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 code is posted below. I have a class for board, and the pieces are part of the board class. I also have a class for human move and computer move, however I'm not using those (yet). I don't know whether I need to use a seperate class for the move, or if I can use a function in the board class to make the move.

Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <iostream>
  3. #include <time.h>
  4. using namespace std;
  5. class HumanMove
  6. {
  7. public:
  8.     void human_move();
  9.  
  10. private:
  11.     char human_piece;
  12.  
  13. };
  14. class ComputerMove
  15. {
  16. public:
  17.     void computer_move();
  18. private:
  19.     char computer_piece();
  20. };
  21. class Board
  22. {
  23. public:
  24.     ~Board(){};
  25.     Board();
  26.     void printb();
  27.     void human_move();
  28.     void computer_move();
  29.     void instructions();
  30.     void setpieces();
  31.  
  32. private:
  33.     char cboard[9][9];
  34.  
  35. };
  36. Board::Board()
  37. {
  38.   char w=177;
  39.   int row,column,side=0,top=0;
  40.   cout<<"Initializing the Checkers Board........"<<endl;
  41.   cout<<"    0  1  2  3  4  5  6  7 "<<endl;
  42.   cout<<"----------------------------"<<endl;
  43.   for(row=1;row<=8;row++)
  44.   {
  45.       cout<<side<<" |";
  46.       ++side;
  47.  
  48.       for(column=1;column<=8;column++)
  49.         if((row+column)%2==0)
  50.             cboard[row][column]=w;
  51.         else
  52.             cboard[row][column]=0;
  53.         cout<<"|"<<endl;
  54.   }
  55.   cout<<"----------------------------"<<endl;
  56. }
  57. void Board::setpieces()
  58. {
  59.     int row=0, column=0;
  60.     for (row=1;row<=8;row++)
  61.         for (column=1;column<=8;column++)
  62.         {
  63.         if ((row+column)%2==0 && row<=3)
  64.             cboard[row][column]='h';
  65.         else if ((row+column)%2==0&&row>2&&row<=5)
  66.             cboard[row][column]=177;
  67.         else if ((row+column)%2==0&&row>5&&row<=8)
  68.             cboard[row][column]='c';
  69.         else
  70.             cboard[row][column]=0;
  71.         }
  72. }
  73. void Board::instructions()
  74. {
  75.     int i=0;
  76.     char s=4;
  77.     for (i=0;i<=53;++i)
  78.     {
  79.         cout<<s;
  80.     }
  81.     cout<<endl<<s<<"  THESE ARE THE INSTRUCTION FOR CHECKERS!           "<<s<<endl;
  82.     cout<<s<<"  1) The computer is represented by a 'c'           "<<s<<endl;
  83.     cout<<s<<"  2) The human is represented by a 'h'              "<<s<<endl;
  84.     cout<<s<<"  3) When a piece is kinged it will be capitalized  "<<s<<endl;
  85.     cout<<s<<"  4) When a piece is kinged it may move backwards   "<<s<<endl;
  86.     cout<<s<<"  5) The computer will move first each time         "<<s<<endl;
  87.     for (i=0;i<=53;++i)
  88.     {
  89.         cout<<s;
  90.     }
  91.     cout<<endl;
  92. }
  93. void Board::printb()
  94. {
  95.   char w=177;
  96.   int row,column,side=0,top=0;
  97.   cout<<"    0  1  2  3  4  5  6  7 "<<endl;
  98.   cout<<"----------------------------"<<endl;
  99.   for(row=1;row<=8;row++)
  100.   {
  101.       cout<<side<<" |";
  102.       ++side;
  103.       for(column=1;column<=8;column++)
  104.         if((row+column)%2==0)
  105.         cout<<w<<cboard[row][column]<<w;
  106.         else
  107.         cout<<" "<<cboard[row][column]<<" ";
  108.         cout<<"|"<<endl;
  109.  
  110.   }
  111.   cout<<"----------------------------"<<endl;
  112. }
  113. void Board::human_move()
  114. {
  115.     char w=177,h=104,c=99;
  116. }
  117. void Board::computer_move()
  118. {
  119.     int row, column;
  120.     char c=99, w=177;
  121.     while (c==99)
  122.     {
  123.         rand();
  124.         row=rand()%8;
  125.         column=rand()%8;
  126.         if (cboard[row][column]!=w)
  127.         {
  128.             cout<<"Invalid move."<<endl;
  129.             c=99;
  130.         }
  131.         else
  132.         {
  133.             cboard[row][column]=c;
  134.             cout<<"The row selected by the computer is: "<<row<<endl;
  135.             cout<<"The column selected by the computer is: "<<column<<endl;
  136.             c=0;
  137.         }
  138.     }
  139. }
  140. void main()
  141. {
  142.  
  143.     srand(time(0));
  144.     int i=0;
  145.     Board play_game;
  146.     HumanMove hmove;
  147.     ComputerMove cmove;
  148.     play_game.instructions();
  149.     play_game.setpieces();
  150.     play_game.printb();
  151.     cout<<"Computer Move...."<<endl;
  152.     play_game.computer_move();
  153.     play_game.printb();
  154. }
  155.  
  156.  
THanks for looking,

J
Jul 19 '07 #1
4 20593
ravenspoint
111 100+
How about this, with a matching method for computer moves

Expand|Select|Wrap|Line Numbers
  1. int Board:make_move_by_human( int old_row, int old_col, int new_row, new_col )
  2. /*
  3. return
  4. 0  - illegal or impossible or meaningless move
  5. 1 - OK, move accomplished
  6. *
/
Jul 19 '07 #2
So I've worked on the code some more and it has changed quite a bit. My problem now is, that I can move a human piece to any "shaded" spot on the board. I'm not sure how to correct this. The code is not completely cleaned up so I appologize.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. #include <iostream>
  4. #include <time.h>
  5. #include <ctype.h>
  6. using namespace std;
  7. class Board
  8. {
  9. public:
  10.     ~Board(){};
  11.     Board();
  12.     void printb();
  13.     void human_move();
  14.     void computer_move();
  15.     void instructions();
  16.     void setpieces();
  17.     int checkwin();
  18.     int trymove (int r, int c);
  19.     void findp();
  20.  
  21. private:
  22.     char cboard[9][9];
  23.  
  24. };
  25. Board::Board()
  26. {
  27.   char w=177;
  28.   int row,column,side=0,top=0;
  29.   cout<<"Initializing the Checkers Board........"<<endl;
  30.   cout<<"    0  1  2  3  4  5  6  7 "<<endl;
  31.   cout<<"----------------------------"<<endl;
  32.   for(row=0;row<8;row++)
  33.   {
  34.       cout<<side<<" |";
  35.       ++side;
  36.  
  37.       for(column=0;column<8;column++)
  38.         if((row+column)%2==0)
  39.             cboard[row][column]=w;
  40.         else
  41.             cboard[row][column]=0;
  42.         cout<<"|"<<endl;
  43.   }
  44.   cout<<"----------------------------"<<endl;
  45. }
  46. void Board::setpieces()
  47. {
  48.     int row=0, column=0;
  49.     for (row=1;row<=8;row++)
  50.         for (column=1;column<=8;column++)
  51.         {
  52.         if ((row+column)%2==0 && row<=3)
  53.             cboard[row][column]='h';
  54.         else if ((row+column)%2==0&&row>2&&row<=5)
  55.             cboard[row][column]=177;
  56.         else if ((row+column)%2==0&&row>5&&row<=8)
  57.             cboard[row][column]='q';
  58.         else
  59.             cboard[row][column]=0;
  60.         }
  61. }
  62. int Board::checkwin()
  63. {
  64.     int i,j;
  65.     for (i=1;i<=8;++i)
  66.         for(j=1;j<=8;++j)
  67.         {
  68.             if (cboard[i][j]=='h'||cboard[i][j]=='q')
  69.             {
  70.                 cout<<"Continue playing....."<<endl;
  71.                 return (1);
  72.             }
  73.             else if (cboard[i][j]!='h')
  74.             {
  75.                 cout<<"COMPUTER WINS!!!"<<endl;
  76.                 return(0);
  77.             }
  78.             else if (cboard[i][j]!='q')
  79.             {
  80.                 cout<<"HUMAN WINS!!!!"<<endl;
  81.                 return(0);
  82.             }
  83.         }
  84. }
  85. void Board::findp()
  86. {
  87.     int i,v=0,j;
  88.     do
  89.     {
  90.     for (i=0;i<=7;++i)
  91.     {
  92.         for (j=0;j<=7;++j)
  93.         {
  94.             if (cboard[i][j]=='q')
  95.             {
  96.                 v=trymove (i,j);
  97.                 if (v==1)
  98.                 {
  99.                         i=10;
  100.                         j=10;
  101.                 }
  102.             }
  103.             else
  104.                 cout<<"INVALID MOVE"<<endl;
  105.         }
  106.     }
  107.     }
  108.     while (v!=1);
  109. }
  110. int Board::trymove(int r, int c)                                    // R AND C REPRESENT ORIGINAL LOCATION OF THE PIECE
  111. {
  112.     if (r>1&&c>1)
  113.     {
  114.         if (cboard[r][c]=='q')
  115.         {
  116.         cout<<"Hello1: "<<r<<" "<<c<<endl;
  117.         cboard[r][c]=177;
  118.         cboard[r-1][c-1]='q';
  119.         cout<<"The computer moves from row: "<<r<<endl;
  120.         cout<<"The computer moves from column: "<<c<<endl;
  121.         cout<<"To row: "<<r-1<<endl;
  122.         cout<<"To column: "<<c-1<<endl;
  123.         return(1);
  124.         }
  125.         else if (cboard[r][c]==177)
  126.         {
  127.         cout<<"Hello2"<<endl;
  128.         cboard[r][c]=177;
  129.         cboard[r-1][c+1]='q';
  130.         cout<<"The computer moves from row: "<<r<<endl;
  131.         cout<<"The computer moves from column: "<<c<<endl;
  132.         cout<<"To row: "<<r-1<<endl;
  133.         cout<<"To column: "<<c+1<<endl;
  134.         return(1);
  135.         }
  136.         else if (cboard [r-1][c-1]=='h'&&cboard[r-2][c-2]==177)
  137.         {
  138.             cboard[r][c]==177;
  139.             cboard[r-1][c-1]==177;
  140.             cboard[r-2][c-2]=='q';
  141.             return(1);
  142.         }
  143.     }
  144. }
  145.  
  146. void Board::instructions()
  147. {
  148.     int i=0;
  149.     char s=4;
  150.     for (i=0;i<=53;++i)
  151.     {
  152.         cout<<s;
  153.     }
  154.     cout<<endl<<s<<"  THESE ARE THE INSTRUCTION FOR CHECKERS!           "<<s<<endl;
  155.     cout<<s<<"  1) The computer is represented by a 'q'           "<<s<<endl;
  156.     cout<<s<<"  2) The human is represented by a 'h'              "<<s<<endl;
  157.     cout<<s<<"  3) When a piece is kinged it will be capitalized  "<<s<<endl;
  158.     cout<<s<<"  4) When a piece is kinged it may move backwards   "<<s<<endl;
  159.     cout<<s<<"  5) The computer will move first each time         "<<s<<endl;
  160.     for (i=0;i<=53;++i)
  161.     {
  162.         cout<<s;
  163.     }
  164.     cout<<endl;
  165. }
  166. void Board::printb()
  167. {
  168.   char w=177;
  169.   int row,column;
  170.   cout<<"    1  2  3  4  5  6  7  8"<<endl;
  171.   cout<<"----------------------------"<<endl;
  172.   for(row=1;row<=8;row++)
  173.   {
  174.       cout<<row<<" |";
  175.       for(column=1;column<=8;column++)
  176.         if((row+column)%2==0)
  177.         cout<<w<<cboard[row][column]<<w;
  178.         else
  179.         cout<<" "<<cboard[row][column]<<" ";
  180.         cout<<"|"<<endl;
  181.  
  182.   }
  183.   cout<<"----------------------------"<<endl;
  184. }
  185. void Board::human_move()
  186. {
  187.     int oldrow=1, oldcolumn=1,row=1, column=1;
  188.     char w=177,h=104;
  189.     do
  190.     {
  191.         cout<<"Enter the row of the piece you would like to move from: "<<endl;
  192.         cin>>oldrow;
  193.         cout<<"Enter the column of the piece you would like to move from: "<<endl;
  194.         cin>>oldcolumn;
  195.         cout<<"Enter the new row you would like to move the piece to: "<<endl;
  196.         cin>>row;
  197.         cout<<"Enter the new column you would like to move the piece to: "<<endl;
  198.         cin>>column;
  199.         if (cboard[row][column]==0)
  200.             {
  201.                 cout<<"INVALID MOVE"<<endl;
  202.                 oldrow=0;
  203.             }
  204.             if (oldrow>=1&&oldcolumn>=1)
  205.             {
  206.                 if (cboard[oldrow][oldcolumn]!='h')
  207.                 {
  208.                     cout<<"INVALID MOVE"<<endl;
  209.                     oldrow=0;
  210.                 }
  211.                 else if (cboard[oldrow][oldcolumn]=='h')
  212.                 {
  213.                     cout<<"Hello1"<<endl;
  214.                     cboard[oldrow][oldcolumn]=177;
  215.                     cboard[row-1][column-1]=177;
  216.                     cboard[row][column]='h';
  217.                 }        
  218.                 else if (cboard[row-1][column-1]=='q')
  219.                 {
  220.                     cout<<"HELLO AGAIN"<<endl;
  221.                     cboard[oldrow][oldcolumn]=177;
  222.                     cboard[row-1][column-1]=177;
  223.                     cboard[row][column]='h';
  224.                 }
  225.                 else
  226.                 {
  227.                     cout<<"INVALID MOVE 2"<<endl;
  228.                 }
  229.         }
  230.         cout<<"The user moves from row: "<<oldrow<<endl;
  231.         cout<<"The user moves from column: "<<oldcolumn<<endl;
  232.         cout<<"To row: "<<row<<endl;
  233.         cout<<"To column: "<<column<<endl;
  234.  
  235.     }
  236.     while (oldrow<1||oldcolumn<1||row<1||column<1||oldrow>8||oldcolumn>8||row>8||column>8);    
  237. }
  238. void main()
  239. {
  240.     srand(time(0));
  241.     int i=0,m=0;
  242.     Board play_game;
  243.     play_game.instructions();
  244.     play_game.setpieces();
  245.     play_game.printb();
  246.     cout<<"Computer Move...."<<endl;
  247.     do
  248.     {
  249.         play_game.findp();
  250.         m=play_game.checkwin();
  251.         if (m==0)
  252.         {
  253.             i=100;
  254.         }
  255.         play_game.printb();
  256.         ++i;
  257.         play_game.human_move();
  258.         m=play_game.checkwin();
  259.         if (m==0)
  260.         {
  261.             i=100;
  262.         }
  263.         play_game.printb();
  264.         ++i;
  265.     }
  266.     while (i<100);
  267. }
  268.  
  269.  

Thanks, J
Aug 9 '07 #3
[
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. #include <iostream>
  4. #include <time.h>
  5. #include <ctype.h>
  6. using namespace std;
  7. class Board
  8. {
  9. public:
  10.     ~Board(){};
  11.     Board();
  12.     void printb();
  13.     void human_move();
  14.     void computer_move();
  15.     void instructions();
  16.     void setpieces();
  17.     int checkwin();
  18.     int trymove (int r, int c);
  19.     void findp();
  20.  
  21. private:
  22.     char cboard[9][9];
  23.  
  24. };
  25. Board::Board()
  26. {
  27.   char w=177;
  28.   int row,column,side=0,top=0;
  29.   cout<<"Initializing the Checkers Board........"<<endl;
  30.   cout<<"    0  1  2  3  4  5  6  7 "<<endl;
  31.   cout<<"----------------------------"<<endl;
  32.   for(row=0;row<8;row++)
  33.   {
  34.       cout<<side<<" |";
  35.       ++side;
  36.  
  37.       for(column=0;column<8;column++)
  38.         if((row+column)%2==0)
  39.             cboard[row][column]=w;
  40.         else
  41.             cboard[row][column]=0;
  42.         cout<<"|"<<endl;
  43.   }
  44.   cout<<"----------------------------"<<endl;
  45. }
  46. void Board::setpieces()
  47. {
  48.     int row=0, column=0;
  49.     for (row=1;row<=8;row++)
  50.         for (column=1;column<=8;column++)
  51.         {
  52.         if ((row+column)%2==0 && row<=3)
  53.             cboard[row][column]='h';
  54.         else if ((row+column)%2==0&&row>2&&row<=5)
  55.             cboard[row][column]=177;
  56.         else if ((row+column)%2==0&&row>5&&row<=8)
  57.             cboard[row][column]='q';
  58.         else
  59.             cboard[row][column]=0;
  60.         }
  61. }
  62. int Board::checkwin()
  63. {
  64.     int i,j;
  65.     for (i=1;i<=8;++i)
  66.         for(j=1;j<=8;++j)
  67.         {
  68.             if (cboard[i][j]=='h'||cboard[i][j]=='q')
  69.             {
  70.                 cout<<"Continue playing....."<<endl;
  71.                 return (1);
  72.             }
  73.             else if (cboard[i][j]!='h')
  74.             {
  75.                 cout<<"COMPUTER WINS!!!"<<endl;
  76.                 return(0);
  77.             }
  78.             else if (cboard[i][j]!='q')
  79.             {
  80.                 cout<<"HUMAN WINS!!!!"<<endl;
  81.                 return(0);
  82.             }
  83.         }
  84. }
  85. void Board::findp()
  86. {
  87.     int i,v=0,j;
  88.     do
  89.     {
  90.     for (i=0;i<=7;++i)
  91.     {
  92.         for (j=0;j<=7;++j)
  93.         {
  94.             if (cboard[i][j]=='q')
  95.             {
  96.                 v=trymove (i,j);
  97.                 if (v==1)
  98.                 {
  99.                         i=10;
  100.                         j=10;
  101.                 }
  102.             }
  103.             else
  104.                 cout<<"INVALID MOVE"<<endl;
  105.         }
  106.     }
  107.     }
  108.     while (v!=1);
  109. }
  110. int Board::trymove(int r, int c)                                    // R AND C REPRESENT ORIGINAL LOCATION OF THE PIECE
  111. {
  112.     if (r>1&&c>1)
  113.     {
  114.         if (cboard[r][c]=='q')
  115.         {
  116.         cout<<"Hello1: "<<r<<" "<<c<<endl;
  117.         cboard[r][c]=177;
  118.         cboard[r-1][c-1]='q';
  119.         cout<<"The computer moves from row: "<<r<<endl;
  120.         cout<<"The computer moves from column: "<<c<<endl;
  121.         cout<<"To row: "<<r-1<<endl;
  122.         cout<<"To column: "<<c-1<<endl;
  123.         return(1);
  124.         }
  125.         else if (cboard[r][c]==177)
  126.         {
  127.         cout<<"Hello2"<<endl;
  128.         cboard[r][c]=177;
  129.         cboard[r-1][c+1]='q';
  130.         cout<<"The computer moves from row: "<<r<<endl;
  131.         cout<<"The computer moves from column: "<<c<<endl;
  132.         cout<<"To row: "<<r-1<<endl;
  133.         cout<<"To column: "<<c+1<<endl;
  134.         return(1);
  135.         }
  136.         else if (cboard [r-1][c-1]=='h'&&cboard[r-2][c-2]==177)
  137.         {
  138.             cboard[r][c]==177;
  139.             cboard[r-1][c-1]==177;
  140.             cboard[r-2][c-2]=='q';
  141.             return(1);
  142.         }
  143.     }
  144. }
  145.  
  146. void Board::instructions()
  147. {
  148.     int i=0;
  149.     char s=4;
  150.     for (i=0;i<=53;++i)
  151.     {
  152.         cout<<s;
  153.     }
  154.     cout<<endl<<s<<"  THESE ARE THE INSTRUCTION FOR CHECKERS!           "<<s<<endl;
  155.     cout<<s<<"  1) The computer is represented by a 'q'           "<<s<<endl;
  156.     cout<<s<<"  2) The human is represented by a 'h'              "<<s<<endl;
  157.     cout<<s<<"  3) When a piece is kinged it will be capitalized  "<<s<<endl;
  158.     cout<<s<<"  4) When a piece is kinged it may move backwards   "<<s<<endl;
  159.     cout<<s<<"  5) The computer will move first each time         "<<s<<endl;
  160.     for (i=0;i<=53;++i)
  161.     {
  162.         cout<<s;
  163.     }
  164.     cout<<endl;
  165. }
  166. void Board::printb()
  167. {
  168.   char w=177;
  169.   int row,column;
  170.   cout<<"    1  2  3  4  5  6  7  8"<<endl;
  171.   cout<<"----------------------------"<<endl;
  172.   for(row=1;row<=8;row++)
  173.   {
  174.       cout<<row<<" |";
  175.       for(column=1;column<=8;column++)
  176.         if((row+column)%2==0)
  177.         cout<<w<<cboard[row][column]<<w;
  178.         else
  179.         cout<<" "<<cboard[row][column]<<" ";
  180.         cout<<"|"<<endl;
  181.  
  182.   }
  183.   cout<<"----------------------------"<<endl;
  184. }
  185. void Board::human_move()
  186. {
  187.     int oldrow=1, oldcolumn=1,row=1, column=1;
  188.     char w=177,h=104;
  189.     do
  190.     {
  191.         cout<<"Enter the row of the piece you would like to move from: "<<endl;
  192.         cin>>oldrow;
  193.         cout<<"Enter the column of the piece you would like to move from: "<<endl;
  194.         cin>>oldcolumn;
  195.         cout<<"Enter the new row you would like to move the piece to: "<<endl;
  196.         cin>>row;
  197.         cout<<"Enter the new column you would like to move the piece to: "<<endl;
  198.         cin>>column;
  199.         if (cboard[row][column]==0)
  200.             {
  201.                 cout<<"INVALID MOVE"<<endl;
  202.                 oldrow=0;
  203.             }
  204.             if (oldrow>=1&&oldcolumn>=1)
  205.             {
  206.                 if (cboard[oldrow][oldcolumn]!='h')
  207.                 {
  208.                     cout<<"INVALID MOVE"<<endl;
  209.                     oldrow=0;
  210.                 }
  211.                 else if (cboard[oldrow][oldcolumn]=='h')
  212.                 {
  213.                     cout<<"Hello1"<<endl;
  214.                     cboard[oldrow][oldcolumn]=177;
  215.                     cboard[row-1][column-1]=177;
  216.                     cboard[row][column]='h';
  217.                 }        
  218.                 else if (cboard[row-1][column-1]=='q')
  219.                 {
  220.                     cout<<"HELLO AGAIN"<<endl;
  221.                     cboard[oldrow][oldcolumn]=177;
  222.                     cboard[row-1][column-1]=177;
  223.                     cboard[row][column]='h';
  224.                 }
  225.                 else
  226.                 {
  227.                     cout<<"INVALID MOVE 2"<<endl;
  228.                 }
  229.         }
  230.         cout<<"The user moves from row: "<<oldrow<<endl;
  231.         cout<<"The user moves from column: "<<oldcolumn<<endl;
  232.         cout<<"To row: "<<row<<endl;
  233.         cout<<"To column: "<<column<<endl;
  234.  
  235.     }
  236.     while (oldrow<1||oldcolumn<1||row<1||column<1||oldrow>8||oldcolumn>8||row>8||column>8);    
  237. }
  238. void main()
  239. {
  240.     srand(time(0));
  241.     int i=0,m=0;
  242.     Board play_game;
  243.     play_game.instructions();
  244.     play_game.setpieces();
  245.     play_game.printb();
  246.     cout<<"Computer Move...."<<endl;
  247.     do
  248.     {
  249.         play_game.findp();
  250.         m=play_game.checkwin();
  251.         if (m==0)
  252.         {
  253.             i=100;
  254.         }
  255.         play_game.printb();
  256.         ++i;
  257.         play_game.human_move();
  258.         m=play_game.checkwin();
  259.         if (m==0)
  260.         {
  261.             i=100;
  262.         }
  263.         play_game.printb();
  264.         ++i;
  265.     }
  266.     while (i<100);
  267. }
  268.  
  269.  

Thanks, J[/quote]
Apr 24 '12 #4
hanouf
1
what does it mean about h=104 in the function human_move()
and who can explain this :
else if (cboard[row-1][column-1]=='q')
{
cout<<"HELLO AGAIN"<<endl;
cboard[oldrow][oldcolumn]=177;
cboard[row-1][column-1]=177;
cboard[row][column]='h';
}

thank you all
Apr 26 '12 #5

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

Similar topics

2
by: Maarten | last post by:
Does anyone can help with this? For our goose game, we have to create the game board in a spiral. It may be a square instead of an oval or circle. Does anyone know a simple formula to do this...
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.
0
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap...
0
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap...
6
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap...
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...
10
by: sam_cit | last post by:
Hi Everyone, I'm working on developing a chess game and i decided to use c++ for its object oriented approach. I have a bass class unit and is inherited to distinct number of units (like king,...
1
by: enp | last post by:
Hello, I am trying to create a board game in C#. I have looked into several different websites for creating a board for my game but I am unsuccessful. can somebody help me with their suggestion...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.