I had just taken a class with C and I wanted to do something I could manipulate with ASCII graphics so I figured I'd make a games package. I started with tictactoe and managed to keep on building on it and generalized it to a very open state now.

How it works

The board games keep track of the moves that the player enters and based on the rules associated with the particular game of tictactoe the user chooses, it decides whether the game is won or not after every move. While it's not won the game will keep on going until a draw occurs.

Challenges I ran into

Getting the tictactoe board generalized into ascii was quite challenging. Also, the when I generalized the amount of X's or O's in a row that one can win with working through the logic was tricky because of the new diagonal ways to win, but I got it working. It was also a little bit tricky testing the diagonals of connect four, but I got that done as well.

Accomplishments that I'm proud of

I spent 20 hours coding this, it works exactly as planned, and I have no memory leaks!

What I learned

I learned that despite the fact C is an old language, one can still make fun, enjoyable programs with it. One needn't have latest access to the newest technologies to build something cool, although such access does tend to enable one to make cool things.

What's next for CGames

I may think about look-ahead algorithms for tictactoe, but it may be difficult considering the current open, general form of the tictactoe game. Maybe I'll start with connect four AI.

Built With

Share this project: