(define (XXXStartGame) (begin (set! XXXGame …) (display ” … a custom rowsing huzzah for your AI … n”) #t ; to return nothing useful to your opponent (define (XXXMarkMove Move) ; a list of ( row column plane) (begin (set! XXXGame … ; refer to the old XXXGame …; do NOT use set! again – no other variables. Move ; you may NOT use set! anywhere else in the code for this assignment (define (XXX ShowGame) (begin (display …) (newline); refer to XXXGame (display …) (newline); you should be able to use recursion #t; to return something small and not disruptive to the display (define (XXXMakeMove) (XXXMarkMove (XXXChooseMove …) ; refer to XXXGame ; to generate a random number from 0 to ‘N’-1 (inclusive) (random ‘N’) Write a Scheme program to play the game 3D Tic Tac Toc (4X4X4), also called Qubic (by Parker Brothers), Rules of the Game: The 4X4X4 version of tic-tac-toe is played on a cube of 3 dimensions with 4 planes of 4 rows and 4 columns each. To players alternate placing markers on the cube. Each player is assigned a unique shape or color (like black or red) to distinguish their markers. Each turn consists of inserting a marker in one of the (unfilled) cube positions. The object of the game is to be the first player to get four adjacent markers of the same shape or color, either vertically, horizontally, or diagonally, in any of the three dimensions User Interface Requirements: To avoid naming clashes between programs, all your functions, plus the one and only global variable that holds your game state, must be preceded by your initials: first, middle, and last, as in JEJ for James Earl Jones. (If you have no middle initial, do the same thing as former U.S. President Harry S. Truman, and make one up.) You must provide the following functions for the user (with “XXX’ replaced by your unique initials): (a) a function to start the game, called XXX StartGame, with no arguments, that returns t. (b) a function to make a move specified by a player, called XXXMarkMove, given one parameter that is a list of three arguments that indicate the row (numbered bottom to top from 1 to 4), the column (numbered left to right from 1 to 4), and the plane (numbered bottom to top from 1 to 4) that returns the same list of three argments. (c) a function to make a simple graphical display of the current game cube, called XXXShowGame, that receives no arguments and returns #t. (d) a function to ask the program to make a move, called XXXMakeMove, with no arguments, that returns a list of three arguments indicating the chosen row, column, and plane for the next move. (e) a function, called XXXLegal MoveP to test a given move (row, column, and plane) to see if It is legal with respect to the current game state, and returns true or false ( twn). (1) a function, called XXX WinP, to test the current game grid to see if the last move resulted in a win: to simplify this task, accept one parameter (row, column, plane) that represents the latest move, and return true or false. (g) a function, called XXXWill WinP, to test the current game grid to see if the given move (row.column. plane) will result in a win for the given marker, and return true or false. The internal state of your gaming program must be maintained in a global variable named XXXGame. All the functions will refer to it to obtain the current state of the game. Function (a) initializes this variable, and function (b) resets it to reflect the new state after the move. The other functions do not change this global variable. Notice that the state of the game must include an indication of which player gets the next turn as well as the current status of the board (the markers in each column). Implementation Restrictions: You may not use any built-in Scheme functions that we have not discussed. You may use begin’ for sequence, but only in the XXXShowGame function. You may not use any variables other than the game state variable described above. For the third function, XXXMakeMove, your program may not choose a gaming strategy that takes an unreasonable amount of time. We will not have an explicit limit, but if I suspect that someone is not being reasonable, I will disqualify them from the tournament, and thus you will not get full credit for the assignment. Show transcribed image text (define (XXXStartGame) (begin (set! XXXGame …) (display ” … a custom rowsing huzzah for your AI … n”) #t ; to return nothing useful to your opponent (define (XXXMarkMove Move) ; a list of ( row column plane) (begin (set! XXXGame … ; refer to the old XXXGame …; do NOT use set! again – no other variables. Move ; you may NOT use set! anywhere else in the code for this assignment (define (XXX ShowGame) (begin (display …) (newline); refer to XXXGame (display …) (newline); you should be able to use recursion #t; to return something small and not disruptive to the display (define (XXXMakeMove) (XXXMarkMove (XXXChooseMove …) ; refer to XXXGame ; to generate a random number from 0 to ‘N’-1 (inclusive) (random ‘N’)
Write a Scheme program to play the game 3D Tic Tac Toc (4X4X4), also called Qubic (by Parker Brothers), Rules of the Game: The 4X4X4 version of tic-tac-toe is played on a cube of 3 dimensions with 4 planes of 4 rows and 4 columns each. To players alternate placing markers on the cube. Each player is assigned a unique shape or color (like black or red) to distinguish their markers. Each turn consists of inserting a marker in one of the (unfilled) cube positions. The object of the game is to be the first player to get four adjacent markers of the same shape or color, either vertically, horizontally, or diagonally, in any of the three dimensions User Interface Requirements: To avoid naming clashes between programs, all your functions, plus the one and only global variable that holds your game state, must be preceded by your initials: first, middle, and last, as in JEJ for James Earl Jones. (If you have no middle initial, do the same thing as former U.S. President Harry S. Truman, and make one up.) You must provide the following functions for the user (with “XXX’ replaced by your unique initials): (a) a function to start the game, called XXX StartGame, with no arguments, that returns t. (b) a function to make a move specified by a player, called XXXMarkMove, given one parameter that is a list of three arguments that indicate the row (numbered bottom to top from 1 to 4), the column (numbered left to right from 1 to 4), and the plane (numbered bottom to top from 1 to 4) that returns the same list of three argments. (c) a function to make a simple graphical display of the current game cube, called XXXShowGame, that receives no arguments and returns #t. (d) a function to ask the program to make a move, called XXXMakeMove, with no arguments, that returns a list of three arguments indicating the chosen row, column, and plane for the next move. (e) a function, called XXXLegal MoveP to test a given move (row, column, and plane) to see if It is legal with respect to the current game state, and returns true or false ( twn). (1) a function, called XXX WinP, to test the current game grid to see if the last move resulted in a win: to simplify this task, accept one parameter (row, column, plane) that represents the latest move, and return true or false. (g) a function, called XXXWill WinP, to test the current game grid to see if the given move (row.column. plane) will result in a win for the given marker, and return true or false. The internal state of your gaming program must be maintained in a global variable named XXXGame. All the functions will refer to it to obtain the current state of the game. Function (a) initializes this variable, and function (b) resets it to reflect the new state after the move. The other functions do not change this global variable. Notice that the state of the game must include an indication of which player gets the next turn as well as the current status of the board (the markers in each column). Implementation Restrictions: You may not use any built-in Scheme functions that we have not discussed. You may use begin’ for sequence, but only in the XXXShowGame function. You may not use any variables other than the game state variable described above. For the third function, XXXMakeMove, your program may not choose a gaming strategy that takes an unreasonable amount of time. We will not have an explicit limit, but if I suspect that someone is not being reasonable, I will disqualify them from the tournament, and thus you will not get full credit for the assignment.
Expert Answer
Answer to (define (XXXStartGame) (begin (set! XXXGame …) (display ” … a custom rowsing huzzah for your AI … n”) #t ; to ret…