PYTHON 3 TICTACTOE Here are the requirements written up more

PYTHON 3 TIC-TAC-TOE

Here are the requirements, written up more formally. These should capture the same information as was given more informally above.

The board shall appear on a canvas that is 350x350 pixels.
The title of the window containing the canvas shall be \"Tic-Tac-Toe\".
The board shall be 300x300 pixels in size.
The board shall be drawn using four lines that are 3 pixels wide.
Two of the four lines shall be vertical.
Two of the four lines shall be horizontal.
The four lines shall divide the board into nine square regions of equal size.
The size of the square regions shall be 100x100 pixels.
The borders shall not be included in the calculation of the size of the square regions.
The board shall be centered in the canvas.
The board shall display at least four \'playing pieces\', Xs and Os.
At least two of the four playing pieces shall be Xs.
At least two of the four playing pieces shall be Os.
The playing pieces shall be 80x80 pixels in size.
Each playing piece shall be centered in one square of the board.
Any given square of the board shall contain no more than one playing piece.
The X playing piece shall consist of two lines.
The two lines of the X playing piece shall extend to opposite corners of the bounding box for the playing piece.
The lines of the X shall be 7 pixels wide.
The O playing piece shall consist of a single closed, curve.
The curve of the O shall be tangent to each of the four edges of the bounding box for the playing piece.
The line of the O shall be 7 pixels wide.

Standard Version

For the Standard Version, create functions to draw the tic-tac-toe board and the playing pieces. You will need to create three functions:

one to draw the tic-tac-toe board
one to draw an X playing piece
one to draw an O playing piece

Each of these functions will take three parameters, the x- and y-coordinates of the lower-left corner of the bounding box and the canvas.

Notice that for the board, the (x,y) values give the coordinates of the lower-left corner of the tic-tac-toe board. The light green border in this image is just to help show where the (x,y) point is relative to the ends of the lines for the tic-tac-toe board. There is no need to draw the light green lines.

Notice that for the X and O, the (x, y) values give the coordinates of the lower-left corner of the square within the board, not the lower-left corner of the bounding box for the visible lines. (Once again, the light green lines are just to help visually orient the image relative to the bounding box; in this case, the borders of the \"square\" of the tic-tac-toe board.)

Using these functions, you could draw the board for the Minimal version with five function calls:

board(-150, -150, canvas)
drawX(-150, -150, canvas)
drawO(-50, -50, canvas)
drawX(50, 50, canvas)
drawO(-50, 50, canvas)

You do not have to use these function names. If the coordinate system isn\'t making sense to you, here is a little guide.

For the Standard version, use these functions to draw two tic-tac-toe boards in a single window.

Window specifications:

The boards are 300x300.
There\'s a 30-pixel boarder around the boards, and a 30-pixel space between them.
So, the canvas is 690x360. (2·300 + 3·30, 1·300 + 2·30)

As with the Minimal Version, each of the two boards shall contain at least 4 playing pieces, 2 Xs and 2 Os. Each playing piece shall occupy its own square on the board. The pieces shall be centered in the squares on the board.

The rest of the coordinates you can figure out from these dimensions.

Solution

#include using namespace std; int main() { int i = 5; int data[5] = {10, 20, 30, 40, 50}; int *p = &i; // point p to the address of i. cout << endl; cout << \"For this exercise, study the code carefully, then compile and run\"< address of beginning of array // NOTE 2: I could also have done: p = &data[0]; // where I take the address of a single integer, in this case the address // of the first element of data. cout << \"now p is equal to data (i.e., it points to the beginning of the array data[])\"<(text[0]) << \" \'\"<(text[1]) << \" \'\"<(text[2]) << \" \'\"<(text[3]) << \" \'\"< .\" << endl; cout << \"We\'ll see a use for this in our next lab, but generally\"<(pc); // but we can force it to work using a re-interpret_cast int *pi = reinterpret_cast(pc); long *pl = reinterpret_cast(pc); long long *pll = reinterpret_cast(pc); float *pf = reinterpret_cast(pc); double *pd = reinterpret_cast(pc); cout << \"First, what everything points to:\" << endl; cout << \"my_cstring : \" << my_cstring << endl; cout << endl; cout << \"char ptr pointing to c-string does what you expect...\"<
PYTHON 3 TIC-TAC-TOE Here are the requirements, written up more formally. These should capture the same information as was given more informally above. The boar
PYTHON 3 TIC-TAC-TOE Here are the requirements, written up more formally. These should capture the same information as was given more informally above. The boar

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site