Almost there, folks! Today we get to the point where the functionality only needs to be debugged, and thus is pretty much done! So next week is debugging, and if we have time, depending on how riddled with errors the code is, get to the GUI.
Let's stop talking about getting to tat point now, and actually get there!
Our final method in the console client is the act method. This'll carry out actions for the game and its about 40 lines long without comments.
First portion! This just creates a string for us, telling us what actions are available, now with added grammar! Easy enough to understand, right?
Lines 102-104 complete our string building process, giving the prompt its own cozy little variable and creating an action that we'll be using in the next part.
As explained in the in-code-commentary, the prompt will show when an action is not selected, at which point a try-catch block is executed. At this point, the chosen action is returned and there's happy fun. No further explanation is needed, I hope? It's all up there in grey!
Questions and comments are wholly welcome, as usual, and I'll see you next week for debugs!
Looks like the survey is pretty decisive, keep the code comments!
ReplyDeleteSimple enough. Note that when I say this, I ran up and down a few times trying to see it right.
ReplyDeleteI can't believe its almost over! I can't wait to hear about the debugging!
ReplyDelete