Closed mayisa87 closed 1 year ago
Issue still exists, all code related to Console output or input has to be shifted to a separate class.
The goal is it to have an UIMethods and an LogicMethods file. The UI class should only hold UI realted things, like user input and output. And it of course will hold some code to validate the input of the user, for example a while loop to be sure the user entered the right input.
The logic class should only hold logic, like filling of the slot machine array, or checking on winning lines. So if there has to be a output to console within the logic, there must be always a method for it in the UIMethods class! Even if it means, having a method only holding a single line like "Console.WriteLine("Single line of output");"
The Program.cs still holds the Main method of course, which handles the game logic, like the main while loop of the game, checking if game is still active and running, and calling the methods so the game can be played, and can also call UIMethods methods of course
https://github.com/1nature/Sloth-Machine-Project/blob/4f11bfc839f7de66a6180ce0f1338fea49300eec/Sloth%20Machine%20Project/SlotMachineMethods.cs#L98-L107
https://github.com/1nature/Sloth-Machine-Project/blob/4f11bfc839f7de66a6180ce0f1338fea49300eec/Sloth%20Machine%20Project/SlotMachineMethods.cs#L109-L113
https://github.com/1nature/Sloth-Machine-Project/blob/4f11bfc839f7de66a6180ce0f1338fea49300eec/Sloth%20Machine%20Project/SlotMachineMethods.cs#L115-120
Those are good examples of an UIMethods method, UI methods should handle input and validation of input from user or handle the output to user on console.
Also outputs like this: https://github.com/1nature/Sloth-Machine-Project/blob/4f11bfc839f7de66a6180ce0f1338fea49300eec/Sloth%20Machine%20Project/SlotMachineMethods.cs#L155 https://github.com/1nature/Sloth-Machine-Project/blob/4f11bfc839f7de66a6180ce0f1338fea49300eec/Sloth%20Machine%20Project/SlotMachineMethods.cs#L162
Here you can for example implement two methods, one to like "PromptBetAmountIncreased(int betAmount)" and one for decreasing message