Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ "Sorry" game

Name: Anonymous 2010-03-11 17:43

    So i have a c++ project for one of my classes where i basically have to recreate the hasbro game "sorry". Im not much of a programmer so i was hoping I could get a little help from you guys. First thing i have to do is be able to read the board. This is what im given:

    /* The Board */
    //////////////////////////////////////////////////////////

    // The different kinds of squares.
    enum SquareKind {
    REGULAR,
    BEGIN, // Begins a slide
    END, // Ends a slide
    STARTSQ, // Start square for a player
    HOMESQ // Home square for a player
    };

    const int MAXKINDS = HOMESQ+1;
    const string kindNames[MAXKINDS] = {"REGULAR", "BEGIN", "END",
    "STARTSQ", "HOMESQ"};

    struct Role { // The role played by a square
    SquareKind kind;
    Color color; // NONE if kind is REGULAR
    };

    struct Pawn {
    Color color; // Color of this pawn, NONE if "no pawn here"
    int num; // Number of this pawn, if Color != NONE
    };

    // Note: Each square is guaranteed to play at most one slide role,
    // and at most one start/stop role.
    struct Square {
    Role slide; // Slide start, end, or REGULAR
    Role ends; // Player start, home, or REGULAR
    Pawn occupant; // Pawn on this square (if any)
    };

    // The board
    struct Board {
    int numSquares; // How many squares total
    Square squares[MAXSQUARES];
    };

    there are a total of 60 squares, including these:

    SQUARES 60
    1 BEGIN GREEN
    2 HOMESQ GREEN
    4 END GREEN
    4 STARTSQ GREEN
    9 BEGIN GREEN
    13 END GREEN
    16 BEGIN RED
    17 HOMESQ RED
    19 END RED
    19 STARTSQ RED
    24 BEGIN RED
    28 END RED
    31 BEGIN BLUE
    32 HOMESQ BLUE
    34 END BLUE
    34 STARTSQ BLUE
    39 BEGIN BLUE
    43 END BLUE
    46 BEGIN YELLOW
    47 HOMESQ YELLOW
    49 END YELLOW
    49 STARTSQ YELLOW
    54 BEGIN YELLOW
    58 END YELLOW

    So could anyone give me some help with how to read the board please?

Name: Anonymous 2010-03-11 17:49

int readBoard( Board *board ) {
        /* This portion left as an exercise for the reader. */
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List