Tags:
tag this topic
create new tag
view all tags
---+Hint: Steps for solving the problem Don't go on to the next step until the first steps work correctly 100% of the time. These steps are not required and can vary but if you do them in the order specified, it will be easier * Step 1: Generate a random solution. Create a method that will generate the generic solution (based on number of pegs and possible colors). Print the solution out in the main method * Step 2: Add a loop to the main method to continue to generate random solutions until the user enters "no" (or "n") * Step 3: Create a method to get the guess from the user and print it out in the main method. * Step 4: Add a method that will "play the game". It first gets the solution and then it continues to get a guess from the user until the guess perfectly matches the solution. It will make it easier to debug if you add an output to this method to output the solution. Eventually this statement will need to be removed. * Step 5: Add a method that counts the number of perfect matches between the solution and the guess. This should be outputted after each guess. * Step 6: Create an independent method that counts the number of times a given letter occurs in a string (you might want to refer to a previous lab) * Step 7: Create a method that computes the number of close answers. See the third hint for help if needed
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2025-08-04
-
CathyBareiss
Home
Site map
Assessment web
BethelAIResources2026 web
CenterForComputing web
ChatGPT web
Intro2AIatBethel web
Main web
Sandbox web
TWiki web
CenterForComputing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback