This game is implemented with C# and WPF form.
Executable: Demo.exe
Visual Studio project files: Project.csproj
In order to dynamically generate most of the UI, I have used three Canvas
inside the StackPanel
.
There are 4 major variables involved in the decision making:
ansList: string[]
ANSWER: string
GUESS: string
count: int
The main flow of my game design:
-
Game preparation
- One element will be drawn from
ansList
as theANSWER
. GUESS
will be initialized as the copy ofANSWER
with[A-Z]
replace by*
- One element will be drawn from
-
Playing stage
- Player clicks the dynamically generated letter button
- If correct -> Replace
GUESS
with correct letter - If incorrect -> Increase
count
, invoke thedrawHangMan()
and set buttonVisibility
toHidden
- If correct -> Replace
- Disable the button clicked
- Player clicks the dynamically generated letter button
-
Winning/Losing stage
- Check if
GUESS == ANSWER
- Then check if
count == 6
- Call
showWin()
orshowLose()
if possible
- Check if