DS Lite Scientific Calculator

iam4722202468/TicTacToe

What is this?

This is a tic tac toe game created to run on the Nintendo DS lite. It uses libnds, an open source C library for the Nintendo DS. It supports both single player and multiplayer functionality

The image at the bottom is static. The lower touchscreen is used to press the buttons.


Features

  • Single player mode
  • Multiplayer mode
  • Statistics are stored from all games and displayed in the statistics menu
  • Three different AI's with increasing difficulty
  • Settings menu where board size and win line length can be changed

How it works

Text

For fun I wrote a library to draw text on the screen pixel by pixel. It uses a large header file containing a binary representation of every ascii character, and has a function which takes a string, a position and a size, then uses this to draw the expected text to the screen. This text can have properties like changing color when pressed, and can trigger events. This is how the menu is done - pressing text calls a function to redraw the screen as a different menu.


Game

An array is used to store the game board. Every time a player presses a tile the game board is updated and checked to see if there is a winner based on the game rules defined in settings. When either a winner is detected or the game board is full, the results are stored and the statistics are updated.


AI

There are 3 different AIs, Easy, Medium, Hard.

Easy will randomly make moves

Medium will randomly make moves, unless it is detected the player will win in the next turn. In this case, the AI will make a move to stop the win.

Hard will use a strategy where it plays near where it recently played (useful for large boards). If it detects that it can win in the next turn, it will make that move. If it detects it will lose in the next turn, it will make a move to prevent that.

Impossible was a mode I originally made then removed. It used the minimax algorithm to decide where to move. My implementation of this algorithm didn't work too well, and was extremely slow in larger boards (more than 25 tiles). I would like to revisit an impossible AI which is capable of running on this limited hardware.

Repository Statistics


Commit History