Git Product home page Git Product logo

tic-tac-toe's Introduction

Tic Tac Toe game

A terminal game for two players. Each player can be:

  • a human (choice is inputted from terminal);
  • a computer:
    • a stupid computer (choice is random)
    • an intelligent computer (choice is made according to a minimax tree):
      • simple slightly improved AI (just makes some moves where it is likely to win);
      • slightly improved AI (when AI is the first player, it plays better; when it is the second player, it plays worse);
      • invincible AI (is designed to never lose).

The most interesting part is building a minimax tree. You can see the code at src/minimax-tree.lisp Code is well commented, so check it out.

Plans:

  1. Invincibility of AI is now only a claim and currently it is being developed and tested...
  2. To better cases when AI is the second player (sometimes it makes terrible choices)
  3. To transform code into three levels of AI: simple, smart, invincible.

How to run quickly

One of the ways you can run this project on Ubuntu:

  • install Steel Bank Common Lisp:
    sudo apt-get install sbcl
  • clone the code from this repository:
    git clone https://github.com/andlys/tic-tac-toe
  • change current directory:
    cd tic-tac-toe/src
  • run the project as script:
    sbcl --script main.lisp
  • enjoy!

Default configuration is:

  • player X - human;
  • player O - AI.

However, you can change it easily as you please. Read 'src/player.lisp' for more info.

Human input visually is made through numpad numbers.

tic-tac-toe's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.