Python problem Problem statement Develop a program that receives a playlist for a game of triqui and determines whether the sequence is valid and, if so, the final result. Player X is always first and O is second. https://i2.wp.com/www.lacoladerata.co/wp-content/uploads/2016/12/triqui2.png?fit=420%2C201&ssl=1 1.2 -> 3.3 -> 1.3 -> 1.1 -> 2.1 -> 2.2 -> * The winner is: O   Entry The coordinates in format (row, column) of each of the players, alternating between X and O, X plays first. Where 1,1 is the upper left corner and 3,3 is the lower right corner.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

Python problem

Problem statement
Develop a program that receives a playlist for a game of triqui and determines whether the sequence is valid and, if so, the final result. Player X is always first and O is second.

https://i2.wp.com/www.lacoladerata.co/wp-content/uploads/2016/12/triqui2.png?fit=420%2C201&ssl=1
1.2 -> 3.3 -> 1.3 -> 1.1 -> 2.1 -> 2.2 -> *


The winner is: O

 

Entry
The coordinates in format (row, column) of each of the players, alternating between X and O, X plays first. Where 1,1 is the upper left corner and 3,3 is the lower right corner.


The end of the game is given by the character "*".


Departure
If there is a winner, the message must be "The winner is: X" or "The winner is: O" without the quotes, as the case may be. Player O corresponds to the capital letter o. In the event of a tie, the message “Tie” must be printed, without the quotation marks.


If there is a winner and there are still coordinates, in addition to the message of the winner or tie, it should be printed only once: "Restart the game" without the quotes, even if there is more than one coordinate.


If a coordinates is given where it had already been played, it must be printed, "Failed movement of X" or "Failed movement of O" as appropriate, with line change without quotes, and the game must continue, being the next movement of the player who made the mistake. Once the game is over (winner or tie), check for failed moves should not be done.


If there is no winner or tie and the game is over, the message to print is "Waiting for play ...", without the quotes.


Examples

Input Example 1

1.1
2.1
1.2
3.1
1.3
3.3
3.2
*
Output Example 1

The winner is: X
Restart the game

Input Example 2

1.1
2.2
2.2
1.3
1.3
*
Output Example 2

X's failed move
Failed O move
Waiting for play ...

Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT