   chess and c++
  well I recoded my chess game and here is some new code.I need to know if I am on the right track so to speak.#include <iostream>using namespace std;class Player{int piece;public:bool win();bool lose();};class Piece {int value;public:void move();void capture();};class King : public Piece{public:void castle_king();void castle_queen();void check();};class Queen : public Piece{};class Rook : public Piece{public:void castle_king();void castle_queen();};class Knight : public Piece{};class Bishop : public Piece{};class Pawn : public Piece{public:void en_passant();};int main(){return 0;}
  Why do you need two booleans for winning and losing? Why not just have one? You either win or you lose... one boolean is fine.Also your methods don't really have much to judge from. You have a move() method that doesn't even take in a parameter so I am not sure how you are going to govern the logic for how a piece moves.There is too little code to judge at the moment how you are doing, as you are declaring methods that have no real context within the logic of a system.   ;  You seem to have ignored everything that was said in this thread. We still don't know if you are trying to write a GUI to play chess or a chess engine, and your skeleton looks about the same as it did before (why does Player have an `int piece' member?).;  Also, why does your main function return 0; without executing any code. Have you actually started programming anything function in your program? Maybe you should attempt to make it yourself and then ask questions when you stumble. This program isn't exactly all that difficult if you think about it.   ;Quote:Original post by boogyman19946This program isn't exactly all that difficult if you think about it.Although programming a chess game (especially if you are a novice programmer) is. It can be easy to set up all your classes in an object-oriented way, but there is a lot of messy logic required to code all the rules. And it looks like you haven't even got to that bit yet.If this is your first game, i would suggest you start off a bit simpler.@colossal: I do not see two boolean. There is a win and lose function, but it would sound a bit wierd if you had just one called win(bool hasWon) or something. Unless those functions are supposed to be getters (i.e. returns true if they have won). If that's the case, i would rename the function bool hasWon()   ;  phil67rpg, clearly you are starting this as an exercise in Object Oriented programming.If this is a human vs human only program then what you have is sort of okay for a start. More than anything else, there is a huge amount missing. However, it's far easier to discover what you need to change later than to expect to get it all right from the start. Sure you'll get some bits wrong, but you'll gain valueable experience by learning from your mistakes.If this is supposed to allow human vs computer play then it is well known that a design such as this does not allow for a sufficient level of AI due to the sheer number of computations involved and you would have to throw this design away and start over after doing a bit of research.   ;  do some math problems to wake your brain up :D   ;  I am trying to draw a 8x8 grid of asterisks.I want to use a doubly nested for loop.here is some of my code.char board[8][8];for(int row=0;row<8;row++){for(int col=0;col<8;col++){board[row][col]='*';}}for(int i=0; i<8; i++){for (int j=0;j<8;j++){cout << board[j];}};  cout << endl;I recommend you learn about questions, and how to ask them. Required reading.   