i need your help very badly....this is for my project in my programing

please help me or just give me some samplesss of program on chess board game by using FUNCTION,ARRAYS,STRUCTURES etc.

this include:

1: each piece have its own move (like pawn it will just move forward and when it will encounter an opponent it will eat it as well as the king, queen, tower, bishops, horse etc.).

2:it has a graphical board (like chess board checkered boxes)so that the player can determine where his piece run.

3:the program should be an interactive for two players (a player for white and black piece.

4:when the first player finished his turn the other player fun his piece again.

5:the graphical interface will be updated everytime the game is played.

6:when the piece is eaten by the opponent it willa automatically removed from the boxes itself.

7:as the pawn reaches it opponents endbase it willa act automatically become queen.

that's all...

<<<<<note: i need this program within this week!!! i will just check this every timea nd then>>>>>


THANK YOU SO MUCH PIPZ IN ADVANCE I REALLY OWE YOU A LOT...

Comments

  • What exactly do you need help with? If you are just looking for free code, www.google.com is a good site.
  • : please help me or just give me some samplesss of program on chess
    : board game by using FUNCTION,ARRAYS,STRUCTURES etc.
    :
    Seems a bit ambitious as a beginner's programming assignement. However.

    Start with your data structures. You need

    typedef struct
    {
    char board[8][8];
    int blackcastled;
    int whitecastled;
    int whosgo;
    } GAME;

    typedef struct
    {
    int fromx;
    int fromy;
    int tox;
    int toy;
    } MOVE;


    these should be pretty self explanatory. Use uppercase for black, lowercase for white, and mnemonics like P = pawn, B = bishop, etc

    Now write several functions.

    1) is a move legal? int move_legal(GAME *g, MOVE *mv)
    2) apply a move to the board. void applymove(GAME *g, MOVE *mv)


    Once you've got that working, work on the display. You need to pass a GAME * and a window to a drawing function. However that is very platform-specific.
    Essentially divide the window up into 64 blocks, and draw white rectangles and back rectangles on alternate blocks to create the board. Once that works, start by just printing characters in black / white to represent the pieces. Write a function

    3) is the square black or white int getsquarecolour(int x, int y)

    4) what are the square's co-ordiantes on screen? void getsquareextents(int x, int y, int *sx, int *sy, int *width, int *height)

    Then start with the mouse.

    Write another fucntion

    getsquare(int sx, int sy, int *x, int *y)

    to convert from mouse click co-ordinates, which your windowing system will give you, to the square. Once a square is clicked, select it - keep a global "selected" variable. Then when the mouse is clicked for the second time, get the destination square. Check that the move is legal. If it is, apply it, if it isn't, clear the selection.

    That's basically your skeleton logic.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories