We've Moved

THIS BLOG HAS MOVED!

It can be found at the new website: http://fifteen15studios.com/blog/

Personal Blog

Want to know more about the man behind the programs? Check out my personal blog: http://havens1515.blogspot.com

Tuesday, January 15, 2013

New App: Tic-Tac-Toe

Yesterday I started some initial work on a new app. This is actually something that I already have programmed as a DOS based C++ program, I just need to build a GUI and translate the code from C++ to Java.

Background
In college I received a project to build a Tic-Tac-Toe game. That was the only requirement... build a working Tic-Tac-Toe game. There was extra credit involved if you were able to make your game unbeatable. For those who don't know, by using the correct logic while playing, it is possible to never allow your opponent to win a game of Tic-Tac-Toe, their only choices are lose or tie.

After completing the project, our professor told us that had we even made a working game that was  two human players, without a computer player aspect, we still would have gotten full credit, due to the vague requirement specification of the project.

I didn't need the extra credit (I already had above 100% in the class due to all of the extra credit he offered) but I was bored and wanted the challenge, so I made my game unbeatable. I later ended up modifying it to give it 3 difficulties: Easy, Medium, and Impossible.

Difficulties
Easy simply picks a random spot to move into. If that spot is already taken, it generates another random spot, and so on until it finds one that's empty and moves into it.

Medium checks to see if it can win, or if you can win. If it can win, it wins. If you can win, it attempts to block you. If neither player is in a position to win, it falls back to the random location.

Impossible uses a HUGE amount of nested if statements (72 if I recall correctly) (correction - the 72 nested if statements were for a different game. This one actually only has about 20 if statements for the computer logic) to make sure that either the computer wins or the game ends as a tie. You cannot defeat impossible difficulty. (At least, not that I know of. Feel free to try to prove me wrong when I release the app!)



Where I am Now
So far I have only begun work on this. I spent some time yesterday working on the initial user interface. It starts with a selection of 1 player or 2 players, if you select 1 player it takes you to a selection of difficulty.

After that, so far nothing happens. I haven't even looked at my old code yet to start implementing game play.

I will begin working on this as well as Auto Respond, and will hopefully have a product available soon(ish)! (I still need to work on the graphics even. You know, the icon and whatnot.)

No comments:

Post a Comment