Course:CPSC312-2023/TicTacToe

From UBC Wiki

Authors: Nick Wong, Michelle Kim

Contents

What is the problem?

Super Tic-Tac-Toe is a more complex and strategic variation of the classic game of Tic-Tac-Toe. The primary difference is the game board, which consists of nine different Tic-Tac-Toe boards that are stacked in a 3x3 grid to create a larger 9x9 grid. The overall goal is to win the larger 3x3 grid by winning three small boards in a row, either horizontally, vertically, or diagonally.

Here's how to play Super Tic-Tac-Toe:

  1. The players take turns making moves in one of the small Tic-Tac-Toe boards.
  2. Each player can choose to play anywhere.
  3. A player wins a small board by getting three of their marks in a row (horizontally, vertically, or diagonally) within that board.
  4. The overall goal is to win the larger 3x3 grid by winning three small boards in a row, either horizontally, vertically, or diagonally.
  5. If the entire 9x9 grid is filled, and no player has won the larger game, the match is declared a draw.

What is the something extra?

The additional rules and larger game board create a more challenging game compared to the classic Tic-Tac-Toe game.

What did we learn from doing this?

In the lecture, we explored how logic programming is primarily used for artificial intelligence (AI), natural language processing (NLP), and expert systems. With further investigation, we have found that logic programming can be used in multiple aspects of the game, including AI, level generation, quest and narrative systems. This made us wonder if logic programming is feasible for a simple game development that does not heavily rely on aspects that we know that logic programming is good in.

While developing super tic-tac-toe, we found that logic programming can be a powerful tool for creating complex game mechanics and enforcing game rules. Prolog's syntax and semantics are well-suited for expressing complex rule-based systems, such as game logic, decision-making, and event handling. In the case of Tic-Tac-Toe, the game has small and relatively simple rules, which can be easily represented as Prolog predicates. We could encode the game state, rules, and winning conditions using Prolog's declarative syntax, which could be used to develop an AI in the future with its built-in search and pattern-matching capabilities to explore possible moves and determine the best move for the AI. With Prolog's ability to handle complex rules effectively, extending the tic-tac-toe's functionality to build super tic-tac-toe was relatively straightforward.

However, one major hardship we faced was a lack of support for graphics and user interfaces. As we were building something more than a regular tic-tac-toe, we wanted to differentiate the 'mini-board' and 'super-board' visually to help users figure out which board they were playing on at any given time. However, Prolog lacks built-in support for graphics, audio, and other multimedia features, which are essential for game development. While it's possible to integrate external libraries to add these features, it can be more challenging and time-consuming than using a language or engine specifically designed for game development.

In summary, Prolog can be a good choice for certain aspects of game development, particularly when it comes to AI, rule-based systems, and logic-based puzzles. However, it might not be the best choice for general game development, especially when compared to more established game development languages and engines.

Links to code etc

https://github.com/michelleykim/prolog_tictactoe