Code Monkey home page Code Monkey logo

freecell's Introduction

freecell

AI-prepared implementation of FreeCell. It serves as a basis for student homework in Artificial Intelligence and Machine Learning course at FIT BUT.

Compilation

Simply run make. Requires C++17-able compiler. The Makefile assumes POSIX threads as available implementation for std::thread, but this can be replaced in the linking step. For Windows users it is required to link PSAPI library in the makefile with -lpsapi in fc-sui:.

Usage

The build process results in binary fc-sui, which expects two positional arguments: Number of card deals to run and seed used for pseudo-random deal generation, thus allowing repeatable experiments.

On top of that, a solver can be picked (--solver), currently allowing:

  • restarting greedy 1-path search (dummy)
  • breadth-first search (bfs)
  • depth-first search (dfs)
    • has a depth limit controlled by --dls-limit
  • and A* (a_star) which allows to select heuristic:
    • Number of cards not in their home destinations (nb_not_home). BEWARE: This is not a proper optimistic heuristic!
    • Custom one (student).

Note that in this public repository, BFS, DFS and A* are not implemented.

Deal difficulty

By default, cards are dealt in a fully random fashion. While most of such games can be solved (estimates are well over 99.9 %), such solutions can be quite deep, esp. as this implementation does not expose super-moves. Therefore, blind search strategies can not be expected to find solutions to such games. For this purpose, easier deals can be produced by making a given number of reverse moves. This is controlled by --easy-mode N, where N is the maximal number of reverse moves made. Note that the depth of the solution is oftentimes much smaller than N because of automatic moves. Blind search strategies can be expected to solve deals up to N around 20. The A* with the default nb_not_home heuristic can realistically solve deals up to N around 35.

Memory usage

Breadth-first strategies can get really wild allocating all the states to explore. Maximal memory consumption can be limited using --mem-limit NB_BYTES. If the program takes more than NB_BYTES in resident memory usage, it aborts itself.

freecell's People

Contributors

ibenes avatar xdanielpaul avatar frnecas avatar michaelamackova avatar you-never-know 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.