类别 全部 - problem - solution - questions - technique

作者:Gary Sibbitts 10 年以前

396

5) 650 - Rock, Paper, Scissors (v2)

Creating effective solutions to problems often begins with a detailed understanding of the problem itself. Using tools like mind maps can help visualize the problem, while structured questions based on Rudyard Kipling’

5) 650 - Rock, Paper, Scissors (v2)

Where next?

You can continue to develop this map without the Smart Map wizard by saving it as a normal Mindomo map.

When have a comprehensive description of the problem, you can move towards finding solutions. Consider a brainstorm as a next step, using the Brainstorming Toolbox Smart Map.

You can delete this topic from the saved map.

Welcome

Researching and describing a problem clearly is the foundation for solving it. Solutions based on incomplete research or poor descriptions can often fail to reach the root causes.

This Smart Map helps you to research and describe a problem from a number of different angles. It contains a mix of factual information-gathering tools and lateral thinking techniques, to develop perspectives that can point towards solutions.

You can use this map individually and in collaboration with others. It is vital to get consensus on the actual problem you are facing, otherwise there may be no consensus on the solution. Putting the descriptions together in one place helps you to explain and agree upon the basis for finding and evaluating solutions.

You can delete this topic from the saved map.

5) 650 - Rock, Paper, Scissors (v2)

GIST(General Idea of Some Thing): Write a console-based program that will allow a user to play Rock-Paper-Scissors against the computer.

Abstract: The console-based program will (describe what happens, paint a word-picture)

Be the problem

Be the problem is a popular technique for understanding problems. It means developing a character for the problem and describing its nature as if it were a person.

Insight

Analogies

Can you find analogies for this problem?

The underlying characteristics of a problem can sometimes be clearer when it is taken out of context.

What is it like?

Six serving men

"Six Serving Men" is based on Rudyard Kipling's poem, which begins:

''I keep six honest serving men
(They taught me all I knew);
Their names are What and Why and When
And How and Where and Who.''


We can profile a problem and perhaps discover more about it by asking structured questions.

Who?
Who not?
Where?
Where not?
How?
How not?
When?
When not?
Why?
Why not?
What?
What not?

Impact analysis

Impact analysis looks at who is affected by the problem - what the consequences are, rather than the causes.

Person
Impact

Root cause analysis

For analytical problems, root cause analysis can help to unravel indirect causes of problems, leading to more effective solutions. One way to do this is to keep asking "Why?" down to five levels, to understand the reasons behind the reasons.

Cause

Solution criteria

How will you know when you have solved the problem?
* What will a successful solution look like?
* How will you filter and assess potential solutions?
* How will you verify that the issue has been solved?
You might want to return to the solution criteria several times as you develop the definition of the problem.

use const int's to represent possible choices and outcomes

0 => Rock
1 => Paper
2 => Scissors
// possible choices
const int ROCK = 0;
const int PAPER = 1;
const int SCISSORS = 2;

// possible outcomes for the player
const int WIN = 1;
const int LOSE = -1;
const int TIE = 0;

no user-defined functions
conditional logic is limited to 'if/else if/else' looping is limited to 'while'
validate player/user input
program will loop until there is a winner

game cannot end in a draw

Console-based program

Perform the following until there is a winner
Input:
Get validated input from user/player and convert to the appropriate choice

Process:
Get the computer's choice
Determine the outcome

Output:
Display computer's choice as: 'rock', 'paper', 'scissors'
Display outcome: player wins, player loses or tie

What assumptions are you making?

In identifying the problem and the probability of a solution, what assumptions are you making?

Assumptions can sometimes be hard to see or accept. For example, if the "problem" is that sales of a certain product are too low, you may naturally aim to increase sales. You are ''assuming'' that the market demand for this product will continue. But if the demand disappeared overnight in a storm of negative publicity, then the original problem and solution also change. So the problem and logical solution are partly based on an assumption.

computer can generate a "good" random number

0 => Rock
1 => Paper
2 => Scissors

a) user knows how to play RPS

What don't you know?

What other information might help, but is not available today?

* How would it help?

* How could you obtain it?

* Can you work without it?

* What are the risks or consequences of not knowing?

* Who else might have further information and insight?

enumerating the available:

How do enumerations support the concept of expressive coding?

results
choices
randomize computer choice

random number generator

What do you know?

Factual data about the problem

Use case(s)
Revised

You can even put the "ideal" script here in the notes.

5) END PROGRAM

a) display a "pause" message before exiting

4) Output

b) display results

indicate exactly what you want to say....
You picked: (Rock, Paper or Scissors) (1, 2 or 3)
Computer picked: (Rock, Paper or Scissors) (1, 2 or 3)
You won - Rock smashes Scissors
Computer won
Tie

a) display computer choice

3) Process

b) compare player and computer choices => results

a) obtain computer's choice

Utilize some kind of random number generator

Random random = new Random();

// return 1 of 3 possible values between 0 and 2 inclusive
int computerChoice = random.Next(3) + 1;
int min = 1, max = 4;
int computerChoice = random.Next(min, max);

2) Input

b) get player's choice

a) prompt player for choice

ask user for an integer or a word or ???
1) Rock
2) Paper
3) Scissors


1) Splash/Welcome

a) Display name of the program and a nice hello

Primary

Here's where you can put your recipe for your Humanoid Analog Computer(HACr).

Fact

Problem type

What tools or patterns apply?

What is the best way to visualize or represent the inputs and outputs for the program?

Expression or series of expressions(simple algorithm)
Timeline?
Collection?

Think about the different types of math word problems you "know" how to solve.