CSCI1300 Notes 11 FactorBlocksTournament Entry

NOTE Change to requirements: you must submit a function that is part of your team entry that played a major role in writing.

Your team's tournament entry will be a function makemove() declared EXACTLY as shown here. It uses the following struct types, which also must be defined EXACTLY as shown.

struct move

{

int marker; // this will always be 0 or 1, depending on which of the two

//markers is being moved

int digit; // this will be a number, 0-11, indicating which of the 12

//binomials the marker is being moved to

};

struct gamestate

{

int movenumber; //this will be 0 for the first move, 1 for the second,

//and so on

int board[7][6]; //each entry contains 0 for X, 1 for 0, 2 for vacant

int markers[2];//markers[0] contains the number of the binomial the first

//marker is on; markers[1] has the other

};

struct move makemove(struct gamestate situation);

Notes

(1) The first player has the X's and makes moves 0,2,4, etc. The second player has the O's and makes moves 1,3,5, etc.

(2) Your program will be called and given the current state of the board. It will figure out what move it wants to make and return it.

(3) You can tell whether you are playing X's or O's by looking at the movenumber in the gamestate you are passed. You need to know this to interpret the situation on the board.

(4) Remember that moves 0 and 1 are different from the rest. On move 0 you MUST place marker 0 , and on move 1 you MUST place marker 1. Thereafter you can move either marker.

(5) If your program returns an illegal move it will lose the game immediately.

(6) Your program should choose its move in the manner envisioned in the design you created for Notes 10.

(7) To test your program you will probably want to adapt your code from Notes 7 so that you can display the game as it evolves, and play against it. Your adapted Notes 7 program should prompt only one player, the human, and use your makemove() function to choose the computer's moves.

(8) Pay very close attention to the following important technical rules:

(8a) The code you submit for your tournament entry must contain your makemove() function, and any functions your makemove() calls, any functions they call, and so on. It must NOT contain a main() function, or your game management code, or other material that is not needed for makemove() itself.

(8b) Your code MUST NOT draw any graphics or print anything. Clayton will be handling all that.

(8c) Your code MUST NOT use any files. If your approach needs files, discuss with Clayton how to do without the files.

(8d) I'll be compiling your code with this command:

gcc -Wall yourcode.c -c -o you.o

The –c flag tells the compiler to compile the code but not to try to make an executable program out of it (it can't... there's no main().) I'll be combining the compiled version of your program, you.o, with other people's code and some code of my own to create the tournament program.

Sooo... you MUST verify that the code you submit can be compiled with this command (of course you can change the name of yourcode.c).

(9) Your contest entry is due electronically before or during class on December 8. Each team member MUST submit a copy of the code (this is to avoid any ambiguity about who participated in what team) AND their time log. I will take the code submitted by the team captain (as designated in Notes 10) as the team's official entry.

NOTE Change to requirements: you must submit a function that is part of your team entry that played a major role in writing.