Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Geometry Puzzle You are designing a simple geometry puzzle for children to learn more about shapes. The puzzle works by having the below functionalities 1

Geometry Puzzle
You are designing a simple geometry puzzle for children to learn more about shapes. The puzzle works by
having the below functionalities
1. Create a custom shape: Allow the user to create a custom shape by providing a minimum of 3(x,y)
valid coordinates.
2. Validate input coordinates: Ensure coordinates input are valid and a convex shape can be formed by
joining the set of coordinates. Also ensures that points are not repeated.
3. Create a random shape: Randomly creates a custom shape with at least 3 valid coordinates
4. Puzzle Section: Allow the user to key in different coordinates and check if the coordinate is within the
shape that has been created
User input and output can be from command line.
When launching the application, it prompts user for actions:
Welcome to the GIC geometry puzzle app
[1] Create a custom shape
[2] Generate a random shape
User should be able to enter 1 or 2 to select how they want the shape to be generated.
Create a custom shape
Upon selecting option 1, application prompts user to key in coordinates Note that the custom shape is
created by joining coordinates 1 to 2 followed by coordinates 2 to 3 then coordinates 3 to 4..... to coordinates
n to n+1 and finally coordinates n+1 back to 1 At any point the application should validate if the new
coordinated is a valid coordinate, if not it should alert the user and ask the user to key in another coordinate.
Application prompts:
Please enter coordinates 1 in x y format
User is then able to enter:
11
The system responds with:
Your current shape is incomplete
1:(1,1)
Please enter coordinates 2 in x y format
README.md 8/2/2022
2/5
User is then able to enter:
51
The system responds with:
Your current shape is incomplete
1:(1,1)
2:(5,1)
Please enter coordinates 3 in x y format
User is then able to enter:
55
The system responds with:
Your current shape is valid and is complete
1:(1,1)
2:(5,1)
3:(5,5)
Please enter # to finalize your shape or enter coordinates 4 in x y format
At this point the User can finalize the shape by pressing # or carry on adding additional points by keying in
coordinates in x y format Assuming the user chooses to finalize the shape.
User responds with # and proceed to the puzzle part of the game:
#
The system then responds with, user then proceeds to the puzzle section from this point on:
Your finalized shape is
1:(1,1)
2:(5,1)
3:(5,5)
Please key in test coordinates in x y format or enter # to quit the game
README.md 8/2/2022
3/5
Validate input coordinates
The system should recognize when new coordinates are invalid and display the new coordinates invalid
message followed by the previous prompt.
Example 1 If the user has created an incomplete shape with coordinates 1:(1,1)2:(5,1) and tries to key in (5,1)
again.
New coordinates(5,1) is invalid!!!
Not adding new coordinates to the current shape.
Your current shape is incomplete
1:(1,1)
2:(5,1)
Please enter coordinates 3 in x y format
Example 2 If the user has created a triangle with coordinates 1:(1,1)2:(5,1)3:(5,5) and tries to key in (4,0)
New coordinates(4,0) is invalid!!!
Not adding new coordinates to the current shape.
Your current shape is valid and is complete
1:(1,1)
2:(5,1)
3:(5,5)
Please enter # to finalize your shape or enter coordinates 4 in x y format
Generate a random shape
Upon selecting option 2, application proceeds to create a random shape with between 3 to 8 coordinates
Note that the shape created must be valid and similar to the custom shape creation scenario, the shape is
created by joining coordinates 1 to 2 followed by coordinates 2 to 3 then coordinates 3 to 4..... to coordinates
n to n+1 and finally coordinates n+1 back to 1
Example random triangle created.
Application prompts the random shape created and user proceeds to the puzzle section:
Your random shape is
1:(1,1)
2:(5,1)
3:(5,5)
Please key in test coordinates in x y format or enter # to quit the game
Puzzle Section
README.md 8/2/2022
4/5
At any point once the shape is finalized the system always responds with
Your finalized shape is
1:(1,1)
2:(5,1)
3:(5,5)
Please key in test coordinates in x y format or enter # to quit the game
At this point the User can choose to quit by entering # or play the game by keying in coordinates in x y
format Assuming the user chooses to play the game.
User enters:
51
System then responds with:
Your finalized shape is
1:(1,1)
2:(5,1)
3:(5,5)
Coordinates (51) is within your finalized shape
Please key in test coordinates in x y format or enter # to quit the game
User enters another test coordinate:
01
System then responds with:
Your finalized shape is
1:(1,1)
2:(5,1)
3:(5,5)
Sorry, coordinates (01) is outside of your finalized shape
Please key in test coordinates in x y format or enter # to quit the game
User chooses to quit:
README.md 8/2/2022
5/5
#
System responds with:
Thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

Ensure continued excellence in people management.

Answered: 1 week ago

Question

Enhance the international team by recruiting the best people.

Answered: 1 week ago