Inspiration

All of us are first time hackathoners. Our names are Lloyd Empedrado, Nathan Murdach, Nil Patel and Shoya Dixon. All of us really wanted to make a game, however, we had to work around our technological limitations and limited experience that all of us could contribute to and feel proud of. A text-based game seemed like a completable task and using external text files was the last topic lightly covered in three of our members classes.

What it does

Our project takes a text file of words and creates an array of strings from the file. It then waits for user input to start the game. Once the user inputs something the game will begin by choosing a random word from the word array. This generates a string of underscores (this represents the spacing) displayed to the user. The gallows along with a score and the blank placeholders will be printed on console. When the user makes guesses, we check the input to see if it is acceptable (no repeated characters, numerical characters, strings that don't match word length) and re-prompt them if it isn't. After that we check to see if the word or character guess is correct. On correct guesses we award 10 points for each character match and 20 points for each missing character in a complete word guess. We take points for guessing wrong words and characters. After the player wins or loses, they get prompted to either continue playing or quit.

How we built it

We used repl.it to quickly collaborate and work together, we built the project using C++. We used C++ making multiple functions to call at the start of a new game, to simulate the game and after a game finishes all using shared variables. We had a function to generate the game state, for running the game state, and what to print after the game ends. We used a switch-case to print out the text-based gallows. This is based on a passed integer representing the chances a player has used. We read a text file using fstream to create our array of words. We used shared variables to track information between methods. We used repl.it to quickly collaborate and work together, we built the project using C++.

Challenges we ran into

We originally wanted to make a more ambitious project but we were unable to due to a majority of our team only having just learned C++, we were limited to only using C++. We were unable to make a graphical C++ game because half of our team was using Macs and didn't have access to Visual C++ to create graphical elements. We decided to create a text-based game for these reasons. And, to quickly and easily collaborate with each other we used repl.it. We had spent a lot of our time just deciding what project to make so we had to quickly outline the functions we would need to define to make our game work and how different pieces of our code would work together.

Accomplishments that we are proud of

As three of our members just finished their first CS class, this will be our first hackathon and for three of us our first and largest collaborative project. Just finishing the project was a great accomplishment for us, a lot of members on our team learned new syntax and coding techniques. One of our members just picked up C++ after over 6 years only having coded 10 or so lines of C++ in his life.

What we learned

We all learned how to work with a team of differing experience levels, some of us stepping out of our comfort level and others learning to build up those around them. Some of us learn new syntax, using global variables and how different data structures work, such as switch-cases. We all learned how to use repl.it to co-program together and also how to test the quality of our game.

What's next for Hangman

Maybe adding different text files of words that relate to certain categories that the player can limit their word pool to. We want to add larger word files, and, potentially, include phrases and special characters. We also had an idea to add a time challenge to really pressure players. For a bigger challenge we could add timers to individual characters. We could also incorporate a database of some sort that would record high scores. Also, this database could be where players could enter their names in order to be recorded alongside their scores before they quit.

Closing thoughts

We all had a really good first hackathon experience, after we decided what we were going to do we spent about an hour planning out how we could do it and then 4 hours creating the logic and making adjustments to our initial plan. We tested part of our code as we implemented them which was a little tricky since in repl.it we would have to wait for one of us to test and comment out everyone else’s code to get rid of compiler errors during testing. After we had a basic working hangman, we got to work on bug testing and implementing features to improve player experience. We added hints, checked player inputs for correctness and tested a bunch of what if situations to see if our program held up to our vision of what it should do. For most of our group completing the project, testing it and fixing it in such a short amount of time given our experience was really exciting and fun, for me (graduate student) I found it was somewhat of a mentoring experience, where I would ask about syntax and teach concepts and logical solutions. Overall, the whole experience exceeded all of our expectation for our first hackathon.

Built With

Share this project:

Updates