Write a function named get_winer that determines who has won a game 10 points of tic-tac-toe....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function named "get_winer" that determines who has won a game 10 points of tic-tac-toe. The function should first check all rows to see whether one player occupies all the cells in one row, next check all columns, and then check the two diagonals. The function takes a two dimensional character array which represents the state of the game (filled with 'O' and 'X') and returns O or 1 or 2 ( O for draw, 1 for player one ('O') wins and 2 for player 2 (X') wins) 1 Add file Write a function named "get_winer" that determines who has won a game 10 points of tic-tac-toe. The function should first check all rows to see whether one player occupies all the cells in one row, next check all columns, and then check the two diagonals. The function takes a two dimensional character array which represents the state of the game (filled with 'O' and 'X') and returns O or 1 or 2 ( O for draw, 1 for player one ('O') wins and 2 for player 2 (X') wins) 1 Add file
Expert Answer:
Related Book For
Discrete and Combinatorial Mathematics An Applied Introduction
ISBN: 978-0201726343
5th edition
Authors: Ralph P. Grimaldi
Posted Date:
Students also viewed these programming questions
-
Write a function named initialLetterCount that takes one parameter, wordList a list of words. Create and return a dictionary in which each initial letter of a word in wordList is a key and the...
-
Write a function named triArea() that takes two parameters for base and height of a triangle, calculates the area and returns it. (Hint: The base of a triangle is calculated as base * height/2)...
-
Write a function named largestOthat takes three integer parameters. The function should return the largest of the three. For example. Given the variable assignments a=30: b=10: c=20. the function...
-
FIGURE P15.62 is a top view of an object of mass m connected between two stretched rubber bands of length L. The object rests on a frictionless surface. At equilibrium, the tension in each rubber...
-
Millions of people now blog for fun or free, but a few are figuring out how to earn part or all of their income from their blogging efforts. ProBlogger (www.problogger.net) can help you get started...
-
The accompanying data file contains quarterly data on expenses (in $1,000s) over five years. For cross-validation, let the training and the validation sets comprise the periods from 2008:01 to...
-
Following data relate to an oil engine working on Otto cycle : Compression ratio \(=6 ;\) B.P. \(=14.8 \mathrm{~kW}\); Suction pressure \(=1\) bar and temp. \(=27^{\circ} \mathrm{C}\); Relative...
-
Modern Company acquires the net assets of Frontier Company for $1,300,000 on January 1, 2011. A business valuation consultant arrives at the price and deems it to be a good value. Part A. The...
-
A fund manager wants to hedge the exposure of her US equity portfolio using futures contracts on the S&P 500. Her portfolio has a value of 10 million USD and a beta of 1.4. The S&P 500 futures is...
-
The sequence number field in the TCP header is 32 bits long, which is big enough to cover over 4 billion bytes of data. Even if this many bytes were never transferred over a single connection, why...
-
Greg Thomas purchased one - half of Ian Hamilton s interest in the Freidman and Hamilton partnership for $ 4 9 , 5 0 0 . Prior to the investment, land was revalued to a market value of $ 1 8 9 , 2 0...
-
A large raindropthe type that lands with a definite splat has a mass of 0.014 g and hits your roof at a speed of 8.1 m/s. a. What is the magnitude of the impulse delivered to your roof? b. If the...
-
How is the story of the myxoma virus and Australian rabbits similar to the story of antibiotic resistance in bacteria?
-
The Gerwitz family resides on a piece of land known as Lot 24 of the Belleville tract, which they acquired by deed in 1996. Shortly thereafter, the Gerwitzes began to use the adjacent vacant Lot 25....
-
How would you determine whether a trait you were interested in studying is heritable?
-
If you jump from a diving board and find that your body is rotating forward, you can spin your arms to stop the rotation and make your body land feet first. Explain in which direction you would...
-
Explain with the chemical reactions listed below why the desired oxygen/hydrogen sulfide ratio in the feed to the Burner Reactor used in the Claus Process should be 1/3 of the stoichiometric...
-
$10,000 was borrowed at 3.5% on July 17. The borrower repaid $5000 on August 12, and $2000 on September 18. What final payment is required on November 12 to fully repay the loan?
-
For the hashing function at the end of Example 14.17, find (a) h(123-04-2275); (b) a social security number n such that h(n) = 413, thus causing a collision with the number 081-37- 6495 of the...
-
(a) Write a computer program (or develop an algorithm) that lists all selections of size 2 from the objects 1, 2, 3, 4, 5, 6. (b) Repeat part (a) for selections of size 3.
-
The following exercise provides a combinatorial proof for a summation formula we have seen in four earlier results: (1) Exercise 22 in Section 1.4; (2) Example 4.4; (3) Exercise 3 in Section 4.1; and...
-
Consider the multiple linear regression model fit to the baseball data in Problem 3.41. Problem 3.41 Consider the 2016 major league baseball data in Table B.22. While team ERA was useful in...
-
Consider the simple linear regression model fit to the rental price data from Problem 2.36. Data From Problem 2.36 Table B.24 contains data on median family home rental price and other data for 51 US...
-
Consider the multiple linear regression model fit to the rental price data in Problem 3.42. Problem 3.42 Table B.24 contains data on median family home rental price and other data for 51 US cities....
Study smarter with the SolutionInn App