Oliver-Akins / Phantom-Ink-Online

The online prototype for Resonym's game titled Phantom Ink.
http://phantominkgame.com/
6 stars 2 forks source link

Trim the whitespace when parsing the object cards csv #107

Closed j-holub closed 3 years ago

j-holub commented 3 years ago

Hey Oliver,

you might remember me, we briefly talked on the Ghost Writer Kickstarter about your implementation of this game (great job btw). I did manage to set this game up on my server with a few tries, your documentation was pretty good.

I already played the game with some friends and it's great. However, we noticed something that we first thought was a bug. Sometimes it worked as expected, we entered the correct word, the input field turned green and we got the return to lobby button, but more often than not, it didn't. I thought it's a bug, but then I realised, out of habit I entered the objects into the csv as follows:

Object1, Object2, Object3, Object4, Object5, Object6

The problem with that was, that the answer for the second to the sixth object wasn't "Object2" but " Object2" with a leading whitespace, hence the string comparison returned false. This was of course entirely my fault, but I thought it doesn't hurt to make the code a little more robust in this regard.

What do you think? Let me know if you don't like the code formatting or the variable name, I can change easly. I can be somewhat picky about stuff like that in my own code, so I would understand ; )

Regards, Jan

Oliver-Akins commented 3 years ago

Hi Jan,

I do indeed remember the discussion we had on Kickstarter. Thanks, I'm quite proud with how it came out. If there were any major parts of the setup that were a struggle for you, please do let me know about it by making an issue about it and I'll work on fixing the documentation, as good documentation is something that I strive for, so any suggestions are greatly appreciated.

This is a great catch! I definitely agree that this shouldn't cause the code to not indicate the correct answer. The code styling and everything looks great to me. Thank you for taking the time to create the pull request!