School-Stuff/Module 4 - Exercise 1 Flowcharting - Rosie Val.drawio

133 lines
7.2 KiB
Text
Raw Normal View History

2026-09-20 23:47:37 -04:00
<mxfile host="draw.io">
<diagram id="guessing_game" name="Ch3 Ex6 - Number Guessing Game (1-100)">
<mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- TITLE -->
<mxCell id="100" value="Ch. 3, Exercise 6 — Guessing a Number Between 1 and 100&#xa;Programmer: Rosie Val" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="170" y="760" width="500" height="50" as="geometry" />
</mxCell>
<!-- START -->
<mxCell id="2" value="Start" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="305" y="20" width="140" height="40" as="geometry" />
</mxCell>
<!-- PROCESS: Generate random number -->
<mxCell id="3" value="Generate a random number&#xa;between 1 and 100" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="250" y="100" width="250" height="50" as="geometry" />
</mxCell>
<!-- PROCESS: Initialize counter -->
<mxCell id="4" value="numGuesses = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="250" y="190" width="250" height="50" as="geometry" />
</mxCell>
<!-- I/O: Output prompt -->
<mxCell id="5" value='Output: "Guess a number between 1 and 100"' style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=15;" vertex="1" parent="1">
<mxGeometry x="250" y="280" width="250" height="50" as="geometry" />
</mxCell>
<!-- I/O: Input guess -->
<mxCell id="6" value="Input: guess" style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=15;" vertex="1" parent="1">
<mxGeometry x="250" y="370" width="250" height="50" as="geometry" />
</mxCell>
<!-- PROCESS: Increment counter -->
<mxCell id="7" value="numGuesses = numGuesses + 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="250" y="460" width="250" height="50" as="geometry" />
</mxCell>
<!-- DECISION 1: guess = number? -->
<mxCell id="8" value="guess = number?" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="295" y="550" width="160" height="80" as="geometry" />
</mxCell>
<!-- I/O: Correct! -->
<mxCell id="9" value='Output: "Correct! You guessed&#xa;it in " + numGuesses + " tries!"' style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=15;" vertex="1" parent="1">
<mxGeometry x="590" y="548" width="270" height="70" as="geometry" />
</mxCell>
<!-- STOP -->
<mxCell id="10" value="Stop" style="ellipse;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="645" y="648" width="140" height="40" as="geometry" />
</mxCell>
<!-- DECISION 2: guess < number? -->
<mxCell id="11" value="guess &lt; number?" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="295" y="670" width="160" height="80" as="geometry" />
</mxCell>
<!-- I/O: Too low -->
<mxCell id="12" value='Output: "Too low, try again"' style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=15;" vertex="1" parent="1">
<mxGeometry x="20" y="685" width="230" height="50" as="geometry" />
</mxCell>
<!-- I/O: Too high -->
<mxCell id="13" value='Output: "Too high, try again"' style="shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=15;" vertex="1" parent="1">
<mxGeometry x="590" y="685" width="230" height="50" as="geometry" />
</mxCell>
<!-- EDGES -->
<mxCell id="20" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="2" target="3" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="21" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="3" target="4" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="22" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="4" target="5" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="23" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="5" target="6" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="24" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="6" target="7" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="25" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="7" target="8" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Decision 1: Yes → Correct output -->
<mxCell id="26" value="Yes" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="8" target="9" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Correct output → Stop -->
<mxCell id="27" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="9" target="10" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Decision 1: No → Decision 2 -->
<mxCell id="28" value="No" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="8" target="11" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Decision 2: Yes → Too low -->
<mxCell id="29" value="Yes" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="11" target="12" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Decision 2: No → Too high -->
<mxCell id="30" value="No" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="11" target="13" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Too low → Input (loop back, left side) -->
<mxCell id="31" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="12" target="6" parent="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="5" y="395" />
</Array>
</mxGeometry>
</mxCell>
<!-- Too high → Input (loop back, right side) -->
<mxCell id="32" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="13" target="6" parent="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="845" y="395" />
</Array>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>