Help with Simon game logic
I'm trying to code this game: https://github.com/dotnet/dotnet-console-games/tree/main/Projects/Simon
I'm currently stuck on trying to add a pattern to a list.
Currently I have an array (string[] Renders) that holds each frame state of the game and a method that shows one of the patterns randomly.
My thought process on the game logic is that after every pattern is shown and correctly repeated, it is added to the list. Rinse and repeat, but obviously call the list with it's previous pattern history.
Link to code:
https://paste.mod.gg/qieexdztawyd/0
GitHub
dotnet-console-games/Projects/Simon at main · dotnet/dotnet-console...
Game examples implemented as .NET console applications primarily for providing education and inspiration. :) - dotnet-console-games/Projects/Simon at main · dotnet/dotnet-console-games
BlazeBin - qieexdztawyd
A tool for sharing your source code with the world!
2 Replies
I know my current implementation is wrong, I was just trying to fiddle around:
using a string variable and assigning it to console.writeline doesn't work since its void
and then I tried just having it as Console.WriteLine(DrawMap()); which works, but it wouldn't be the same pattern when I do PatternHistory.Add(DrawMap());
am i just approaching this completely wrong in the first place?
not using goto would be a good start
also why use renders[default] instead instead of renders[0]
or better, assigning 0 to a constant
logic could very well be centralized, it's duplicated a bunch of times