DEV Community

just.ernst
just.ernst

Posted on

Trying to get a Software Engineer Job.

I am a disabled vet after an 11-year long career in the army who decided to change my career into computer science. Now a new senior, I envisioned myself with an internship already. That is not the case, unfortunately. During my time at Kennesaw State University, I participated in the SAIS 2020 conference and won Best Paper in my category. I was invited to publish the follow-up in their journal. Yet, I was not able to secure an interview.
With the limited information that I had, I concluded that my GitHub portfolio was too weak. I joined Codeacademy.com and started their computer science pro program. Based on their site, to complete their course, I must complete several Final projects that are portfolio-worthy. 
The first final project is a Hangman Game. I took the time to design an Automata diagram to simplify the coding process and reduce confusion.
Automata Diagram 1
The first diagram covers the main states of the program. The second covers the logic inside of states 1P and 2P. 1P and 2P stand for one-player and two-player play through respectively.
Automata Diagram 2
The planning done, I coded the main.py first following the logic I laid out in the previous diagrams. I wanted to keep the main.py to only function calls. I devised an interface and back-end function scheme.
main.py
Next, I focused on the Interface.py functions. I limited them to the interactions with the player or players. Within these interface functions, I added all the objects and backend function calls needed.
interface.py
Then I coded the state management functions. All of them handle the returning of transition codes and the logic behind them. The next set of codes were the game and player objects. 
Game object structure
Player object structure
I wanted to have logic for a basic AI within the Player object to give the single players a challenge. I used an if statement to split the instantiation of players to accommodate the AI. Lastly, I coded the AI. I used an elementary logic string: analyze the mask, reduce the number of possible words, pick a random word from the reduced list, pick a random letter from that word corresponding to an empty slot on the mask.
Some of AI logic
In essence, the code reduces the number of possible words every time the mask is updated and pics a letter from that list in an empty position on the mask. To increase competitiveness and strategy, the winner is the first player to input the last letter and the loser is the first player to error 6 times. With that in mind, you can intentionally answer worn in order to pick the last letter. Also, you cannot let the AI guess most of the missing letters and input the final letter. 
Gameplay screenshots
I played it a couple of times and I had my friends and family play it also. We all agree that the strategic element and the AI make for a challenging game. I want to extend a thank you to www.codeacademy.com for inspiring this project. It was challenging and fun to work on. In the end, I made animated ASCII art for the lost and win screen. If you want to check it out, go to my https://github.com/ernst-fanfan/Hangman-V1.0. This blog has no sponsors and no one is paying me to write it.

Top comments (0)