GithubHelp home page GithubHelp logo

langorou / langorou Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.36 MB

IA for the game "Vampires VS Loup Garous" of the CentraleSupélec IA class.

Go 98.28% Makefile 1.72%
game tournament ia artificial-intelligence centralesupelec

langorou's Introduction

Langorou

This is an IA for the game "Vampires VS Loup Garous" of the CentraleSupélec IA class.

The rules of the game are described here.

A thorough documentation is available here

Requirements

You will need to have make and a go toolchain installed (version >= 1.11 to support go modules).

Build and run

To build the project simply run make, this will create a binary at build/langorou, that you can then run:

langorou -name <player_name> <host> <port>

  • the -name parameter is optional.
  • host and port are the locations of the game server.

Playing

Run make auto to launch a game, you can view it on http://localhost:8080

Tournament

You can launch a tournament on predefined maps with are located in maps/.

Or you can launch a tournament on random maps with go run cmd/tournoi/main.go. You can configure the random maps generation with some flags (more details in the cmd/tournoi/main.go)

Results for the latest tournament are the following:

Final Scores
--------
min_max_1000000000_c1.00_b0.20_nb0.40_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg3_g0 - 145 points
min_max_1000000000_c1.00_b0.02_nb0.03_cs0.000_ws1.00e+10_lowr1.00_wt0.80_mg3_g0 - 140 points
min_max_1000000000_c1.00_b0.05_nb0.05_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg3_g0 - 131 points
min_max_1000000000_c1.00_b0.02_nb0.03_cs0.000_ws1.00e+10_lowr1.20_wt1.00_mg2_g0 - 145 points
min_max_1000000000_c1.00_b0.50_nb0.50_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg3_g0 - 138 points
        dumb IA -  21 points
min_max_1000000000_c1.00_b0.20_nb0.20_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg3_g0 - 137 points
min_max_1000000000_c1.00_b0.02_nb0.03_cs0.000_ws1.00e+10_lowr0.80_wt0.80_mg2_g0 - 164 points
min_max_1000000000_c1.00_b0.00_nb0.00_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg3_g-0 - 125 points
min_max_1000000000_c1.00_b0.02_nb0.03_cs0.000_ws1.00e+10_lowr1.00_wt1.00_mg2_g0 - 152 points

We see that the best parameters are:

client.HeuristicParameters{
    // Not risk averse at all
    Counts:           1,
    Battles:          0.02,
    NeutralBattles:   0.03,
    CumScore:         0.0001,
    WinScore:         1e10,
    LoseOverWinRatio: 0.8,
    WinThreshold:     0.8,
    MaxGroups:        2,
    Groups:           0,
}

Testing

To run the tests you can run: make test, by default this will run all the tests of this project. To limit the tests you want to run you can do make test pkg=./pkg/client to run only the tests of the pkg/client package.

Benchmarking

You can run benchmarks by running make benchmark a lot of parameters are available:

  • benchname to specify which benchmark to run (by default all benchmarks are run)
  • profile (by default /tmp/profile.out to specify where to save a profile of the benchmark, this can then be analyzed by pprof using: go tool pprof -http localhost:6080 /tmp/profile.out.cpu and going at http://localhost:6080 on your browser, it produces two profiles:
    • a cpu profile at <profile>.cpu
    • a memory profile at <profile>.mem
  • benchtime to limit the benchmark time (format is for instance: 2s or 500ms)
  • pkg to only run benchmarks of a specific package

Replays

After a tournament (or a game if you saved it), you can replay the matches with cmd/replay/main.go -replay "<path_to_replay>", or the more convenient make replay replayPath="<path_to_replay>" and analyse it at http://localhost:8080.

The initial position 0 isn't display, it starts after the first move.

langorou's People

Contributors

anatolebeuzon avatar dixneuf19 avatar sfluor avatar victor-paltz avatar

Stargazers

 avatar

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.