This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help With Program. (975), I need help making a naughts and crosses program. (970)

I have a C. OK recently i decided to make a naughts and crosses program but soon found out that it was harder than i thought because i had to use matrix and i don't have a clue how to use them or what it is. can someone please give me a hand or explain what i need to do? P.S. I got rid of the failed program before i thought of posting in the forum.

Parents
  • 1) This is standard C, so you can find a lot of nice explanations of one-dimensional or multi-dimensional arrays in C.

    2) You can either use a two-dimensional array:

    char board_data[BOARD_SIZE][BOARD_SIZE];
    


    or you can use a one-dimensional array - a vector:

    char board_data[BOARD_SIZE*BOARD_SIZE];
    


    The only difference is if you will address your data as:

    if (board_data[x][y] == 'x') { ... }
    


    or as:

    if (board_data[x*BOARD_SIZE+y] == 'x') { ... }
    

    3) The really interesting part is how you plan to build an embedded system (this is a forum for embedded systems, or more specifically for the use of Keil tools to create the software for embedded systems).

    Did you plan to create a an array of two-colored LEDs and use one color for a cross and the other color for naughts?

Reply
  • 1) This is standard C, so you can find a lot of nice explanations of one-dimensional or multi-dimensional arrays in C.

    2) You can either use a two-dimensional array:

    char board_data[BOARD_SIZE][BOARD_SIZE];
    


    or you can use a one-dimensional array - a vector:

    char board_data[BOARD_SIZE*BOARD_SIZE];
    


    The only difference is if you will address your data as:

    if (board_data[x][y] == 'x') { ... }
    


    or as:

    if (board_data[x*BOARD_SIZE+y] == 'x') { ... }
    

    3) The really interesting part is how you plan to build an embedded system (this is a forum for embedded systems, or more specifically for the use of Keil tools to create the software for embedded systems).

    Did you plan to create a an array of two-colored LEDs and use one color for a cross and the other color for naughts?

Children
No data