Create a game that displays a three-by-three grid

Assignment Help Computer Engineering
Reference no: EM131851787

Problem

a. Create a TicTacToe game. In this game, two players alternate placing Xs and Os into a grid until one player has three matching symbols in a row, either horizontally, vertically, or diagonally. Create a game that displays a three-by-three grid containing the digits 1 through 9, similar to the first window shown in Figure 8-15. When the user chooses a position by typing a number, place an X in the appropriate spot. For example, after the user chooses 3, the screen looks like the second window in Figure 8-15. Generate a random number for the position where the computer will place an O. Do not allow the player or the computer to place a symbol where one has already been placed. When either the player or computer has three symbols in a row, declare a winner. If all positions have been used and no one has three symbols in a row, declare a tie.

288_TicTacToe game.jpg

b. In the TicTacToe game, the computer's selection is chosen randomly. Improve the game so that when the computer has two Os in any row, column, or diagonal, it selects the winning position for its next move rather than selecting a position randomly.

Reference no: EM131851787

Questions Cloud

What is the probability that exactly four people : What is the probability that exactly four people of this group have the same birthday and that all the others have different birth-days
Discussion on the rate of pay requested : Advise Lim whether to accept the labours' initial offer of working overtime. Support your argument with the Linear Programming Graph.
What is the probability that one will arrive : What is the probability that one will arrive between 1:00 PM. and 1:12 RM., and the other between 1:17 PM. and 1:30 RM.?
Expansion project-requires initial fixed asset investment : Summer Tyme, Inc., is considering a new 3-year expansion project that requires an initial fixed asset investment of $1.458 million.
Create a game that displays a three-by-three grid : Create a game that displays a three-by-three grid containing the digits 1 through 9, similar to the first window shown in Figure 8-15.
Crime investigation six innocent suspects : If during a crime investigation six innocent suspects are examined by the operator, what is the probability that at least one of them is detected as guilty?
Questionnaire to a group of randomly selected people : A social scientist is about to send a questionnaire to a group of randomly selected people. If 30% of the population are younger than 25 and 17%
Observation of the taking of the physical inventory : For what purposes do the auditors make and record test counts of inventory quantities during their observation of the taking of the physical inventory? Discuss.
Make a journal entry for each of the transactions : Please make a journal entry for each of the transactions. Remember that the revenues must be classified as unrestricted, temporarily restricted.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Design a combinational circuit that converts a binary number

Design a combinational circuit that converts a binary number of four bits to a decimal number in BCD. Note that the BCD number is the same as the binary number as long as the input is less than or equal to 9.

  Describe how the two processors can share the computation

Suppose we have a two-processor distributed memory system in which floating point arithmetic proceeds at R flops per second. Assume that when one processor.

  Based on the kramer 2013 article in the electronic reserve

write a 200- to 300-word short-answer response to the followingbased on the kramer 2013 article in the electronic

  Implementations of a priority queue

Your assignment is to write and compare two implementations of a priority queue whose highest priority element is the one with the smallest keyvalue.

  Use the int cast process to convert to an integer

give Output the corresponding letter grade along with the initial number entered in decimal format utilizing the printf method and format specifiers. Output the number in only 3 decimal places.

  Describe the considerations that you would take into account

Describe the considerations that you would take into account when selecting the menu style for an application and why

  Determine at least two windows server active directory

Determine at least two Windows Server 2012 Active Directory user creation scenarios and specify one Active Directory user object creation tool.

  Determine which type of cache memory is the most efficient

Determine which type of cache memory is the most efficient, and provide one example that depicts the manner in which the use of one type of cache memory makes your computer processing more efficient than another.

  Discuss special array operations needed on vector processors

Discuss the special array operations needed on vector processors to enable parallel execution of conditional operations, that is, vectorizing loops containing.

  Discuss the relative merits and effects on instruction cycle

Discuss the relative merits and effects on the instruction cycle implementation of the following parameter-passing techniques.

  Write an evaluator for the language of sums and products

We can use structures to represent syntax trees in Prolog. For example, the expression, (3 * 4) + (5 + 6) can be represented by the syntax tree: sum(prod(num(3), num(4)), sum(num(5), num(6))) Write an evaluator for the language of sums and products

  Sketch a low power schottky ttl nand circuit

Sketch a low-power Schottky TTL NAND circuit. - What are the primary differences between this circuit and the regular DTL circuit considered earlier in the chapter?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd