Introduction
My name's Derek and I'm an aspiring software engineer! Recently I've been trying very hard to learn Python and the fundamentals of software development through an online course. Having graduated from college two years ago with a Bachelor's in Business Computing and Information Systems, I am relatively familiar with the software development process and have some IT skills; but I have quite a bit to learn on the technical side when it comes to programming and problem solving. So, I decided to take the aforementioned course as a means of supplementing the knowledge and skills I was able to pick up while in college and making my resume stand out more. Since practice makes perfect, especialy in the realm of IT, I decided to undertake a project in support of the programming fundamentals I've been learning in the course. And for this project I decided to build a tic-tac-toe terminal game: something that would be fun yet challenging to do. I am writing this post to share the finished product I was able to conjure up (with some help) and get some feedback on my execution of the project along with how best to proceed with my journey of becoming a software engineer. So let's dive right in!
A Description About the Code
The way that the program was built was by breaking down the overall solution into a number of smaller components called functions that all work together to form a working application. The first function was the insertLetter function, which is what allows the player to place a letter onto the board. The second function was the spaceIsFree function, which checks whether a space is free before an insert is made into that spot. The third function was printBoard, which draws the tic-tac-toe board and updates the board with moves made by the player and the computer. The fourth function was the isWinner function, which keeps track of the moves being made on the board to then determine whether the player or the computer is the winner. The fifth function was the playerMove function, which allows the player to make their move on the board. The sixth function was the compMove function, which allows an ai opponent (i.e. the computer) to make moves with the core aim of winning the game. The seventh function was selectRandom, which enables the opponent to make moves at random that could potentially lead to a win. The eighth function was isBoardFull, which checks to see if the board has been filled with moves and if there are no more empty spaces so the game can be brought to an end. The ninth function was resetBoard, which clears the board should a player want to play another game of tic-tac-toe. The final function was main, the function that makes use of nearly all the other functions in order to allow a game of tic-tac-toe to be played.
To review the code for yourself or to be able to play the program for yourself, here's a link to the GitHub repository for the Tic-Tac-Toe game: Tic-Tac-Toe Terminal Game.
Conclusion
While this project was a bit challenging, the making of this application taught me a lot about what goes into building an application: I had to think of an idea, understand the problem at hand and break it down into solution components, control different versions of the application while building the actual application, troubleshoot bugs and errors, and maintain the applicaiton so that it worked efficiently and effectively post development. That said, I have much more to learn and a lot more practical experience to gain as a junior software engineer. If anyone of you so happens to be interested in mentoring me, offering me a paid internship position, or giving me advice, I'd be more than grateful. Have a nice one and hope you enjoyed this amateur blog post.
Top comments (0)