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: stringGUESS: stringcount: int
The main flow of my game design:
-
Game preparation
- One element will be drawn from
ansListas theANSWER. GUESSwill be initialized as the copy ofANSWERwith[A-Z]replace by*
- One element will be drawn from
-
Playing stage
- Player clicks the dynamically generated letter button
- If correct -> Replace
GUESSwith correct letter - If incorrect -> Increase
count, invoke thedrawHangMan()and set buttonVisibilitytoHidden
- 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

