Menu

[Solved]Task 1 Draw Flowchart Presents Steps Algorithm Required Perform Task Specified Draw Flowch Q37202318

Task 1 Draw a flowchart that presents the steps of the algorithmrequired to perform the task specified. You can draw the flowchartswith a pen/pencil on a piece of paper and scan it for submission.Please ensure that the scanned file and your handwriting are clearand legible. However, it is preferable to draw flowcharts using adrawing software. Here are links to some free drawing toolshttps://www.draw.io/ www.lucidchart.com http://dia-installer.de/https://pencil.evolus.vn/

———————————DON’T NEED THE PYTHON CODE…JUST THE ALGORITHM AND FLOW CHART——————————————————————————————————————————————————————————————————————

design a game of Nim in Python. In this game “Two players taketurns removing objects from distinct heaps or piles. On each turn,a player must remove at least one object, and may remove any numberof objects provided they all come from the same heap/pile. The goalof the game is to avoid taking the last object.” (Wikipedia) Inyour implementation of the game, there will be 3 piles of objects.At the start of the game, each of the three piles will beinitialized by a random number of objects. Random number should bebetween 5 and 15. The players will take turn picking up objectsfrom the piles. A player can even pick up all items from a singlepile. The player that picks up last object (across all piles)loses. You should use functions in the program. Functions mustfollow a good programming style, that is, any well-defined taskwhich needs to be executed often, can be moved into its ownfunction. Following is a sample run of the program. You shouldfollow same display style. You have to handle invalid inputs aswell, as demonstrated by several examples in the sample run. IN thegiven example, initially the game starts with randomly chosennumber of objects (7,13,9). The program prompts both players toselect a pile and choose how many objects to remove. =====

———————————————————————————————————————————————————————————————————————————————

Output

—————————————————————————————————————————————————————————————————————————————-

==== Welcome to Nim Game =====

Here are the three piles
A: *******
B: *************
C: *********
(7, 13, 9)

Player 1, choose your pile (A, B, C): C
Choose how many objects to remove: 5
OK

A: *******
B: *************
C: ****
(7, 13, 4)

Player 2, choose your pile (A, B, C):krypton
ERR: Sorry, that is not a valid pile.
Player 2, choose your pile (A, B, C): A
Choose how many objects to remove: 7
OK
A:
B: *************
C: ****
(0, 13, 4)

Player 1, choose your pile (A, B, C): B
Choose how many objects to remove: alpha
ERR: Sorry, that is not a valid number.
Choose how many objects to remove: 10
OK

A:
B: ***
C: ****
(0, 3, 4)

Player 2, choose your pile (A, B, C): C
Choose how many objects to remove: 8
ERR: Sorry, there is not enough objects to remove in thispile.
Choose how many objects to remove: 4
OK

A:
B: ***
C:
(0, 3, 0)

Player 1, choose your pile (A, B, C): C
ERR: Sorry, this pile is already empty.
Player 1, choose your pile (A, B, C): B
Choose how many objects to remove: 1
OK

A:
B: **
C:
(0, 2, 0)

Player 2, choose your pile (A, B, C): B
Choose how many objects to remove: 2
OK

A:
B:
C:
(0, 0, 0)

Player 2 picked up the last object. <<< Player 1>>> is the WINNER.

Thanks for playing. Goodbye.

Expert Answer


Answer to Task 1 Draw a flowchart that presents the steps of the algorithm required to perform the task specified. You can draw th… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *