Code Monkey home page Code Monkey logo

loveletter-monte-carlo's Introduction

LoveLetter-Monte-Carlo

The implementation of the monte-carlo algorithm used to make intelligent decisions in the game loveletter

This was a univeristy project in which we were required to create an agen capable of playing the game loveletter

the rules for the game can be found here: https://www.ultraboardgames.com/love-letter/game-rules.php

To create an intelligent agent, I have chosen to implement the monte carlo algorithm. The professor created a simulator and agents that make moves at random. The MCagent which implements the monte carlo algorithm was found to perform better than the randomagents, yet not so well when put up against a "reflex agent" that utilizes a simple strategy and does not consider future or past game states.

to run the code download into a local directory. navigate to the root directory and call javac loveletter/LoveLetter.java . Then after compilation is successful call java loveletter/LoveLetter to run the simulation. To make the monte-carlo agent competent, a high value of iterations were necessary to explore enough gamestates. Therefore running the 100 simulations necessary to observe a significant improvement in the MCagent over the random agents. You can reduce the number of games played by going into loveletter/LoveLetter.java and on line 50 change the following code:

for(int g = 0; g < 100; g++)

Into the number of games desired

Furthermore, more agents can be found in the agents folder. To test different agents simply go into the LoveLetter.js file and on line 90 replace the following code:

Agent[] agents = {new agents.RandomAgent(),new agents.RandomAgent(),new agents.RandomAgent() , new agents.MCAgent()};

You can simply replace agents.some_agent into any agent you find in the agents folder. For example, try the following code to test the MCAgent against three reflex agents:

Agent[] agents = {new agents.ReflexmAgent(),new agents.ReflexAgent(),new agents.ReflexAgent() , new agents.MCAgent()};

loveletter-monte-carlo's People

Contributors

ramomri avatar

Watchers

 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.