You have multiple tasks to complete. You may work with others, however your goal should be on understanding the logic of the flow charts you are creating, and by the end feel comfortable analyzing a problem, breaking it down into steps, and be able to create a flow chart of those ideas. You should also feel comfortable looking at a flow chart and determining if you feel it solves the problem it is for.
With this lab, you will want to use a unispace font. One way to gain this is to put your answers betwwen lines that contain three ~ characters:
This is a unispace font, notice that
iiii takes up as much space as
wwww.
To draw the boxes,
- Use hyphens for the top and bottom of the statement boxes (you do not need to worry about the sides).
- Use |, +, - to draw the lines.
- Use <, >, ^, or v for the arrow heads.
- Use / and \ for the borders of conditionals (you only need to show the corners, and these do not need to line up.)
- Have your lines that go up do so to the right of your text.
Example:
-----------------------
This is the first step <-----+
----------------------- |
| |
V |
/ \ |
/ \ Yes |
/ If something is true \ -----+
\ and the day is /
a Monday
\ /
\ /
| No
v
---------------------
The last step
---------------------
- starting at one and incrementing by one to a number that is given, print out either the number, or if the number is divisible by 2, print "Fizz", and if the number is divisible by 3 print "Buzz"
- This game is played between two players.
- There are piles of stones, the number of stones in each pile is known.
- Each turn a player can take any number of stones away from a single pile (they must take at least one.)
- The person who takes the last stone from the last remaining pile looses.
a. Create a flow chart for the optimal move for a player if there is only one pile.
b. Create a flow chart for the optimal move for a player if there are exatly two piles.
c. Can you merge these together to create a flowchart for an optimal move if there are two or less piles? Please do so, if yes.
d. What about if there are any number of piles.
b: modify this to find the sum of the next 100 numbers when given a starting value.
- The 0th and the 1st fibonaci numbers are both 1.
- All other fibonaci numbers equal the sum of the two before it. So the 2nd fibonaci number is 2, because fib(0)+fib(1) = 1+1 Also the 10th fibonaci number is fib(8)+fib(9)