Giter VIP home page Giter VIP logo

artificial-uno's Introduction

Artificial-UNO

An UNO-game for AIs.

Competition

For Knowit Objectnet's internal seminar in Rome. The goal of the competition is to create a program that beats the programs of the other participants in UNO.

Rules

Uses the standard UNO-rules, see https://en.wikipedia.org/wiki/Uno_(card_game). A few details about the official rules that might be surprising to the average UNO-player:

  • The aim of the game is to be the first player to score 500 points.
  • Points are achieved by being the first to play all of one's own cards. Points are rewarded based on the cards held by the other players. Number cards count their face value, all action cards count 20, and Wild and Wild Draw Four cards count 50
  • the amount of cards still held by the other players.
  • "Progressive/Stacking UNO" (see https://en.wikipedia.org/wiki/Uno_(card_game)#House_rules) is not a part of standard UNO.
  • A player may play a Wild Draw Four card only if that player has no cards matching the current color. It is however allowed to lie and play it anyway, but the next player may choose to challenge its use. The player who played the Wild Draw Four must privately show their hand to the challenging player in order to demonstrate that they had no prior matching colored cards. If the challenge is successful, then the challenged player must draw four cards instead and play continues with the challenger. Otherwise, the challenger must draw six cards โ€“ the four cards they were already required to draw plus two more cards โ€“ and lose their turn.

How to participate

Create a pull request which adds your agent to the agent-folder before 19th of October 23:59.

Setup

artificial-uno uses Python 3.10 features, you therefore need to run it with Python 3.10 or greater.

I also recommend setting up a virtual environment for this project (see venv).

After setting up your virtual environment with the correct Python version, install the projects dependencies by running

pip install -r requirements.txt

Test setup

Try running

python unoenv.py

from your virtual environment. This should start a game with one player-controlled agent and two agents who make random moves. See their implementation in agents/textagent.py and agents/randomagent.py.

Creating your own agent

To create your own agent you need to create a class that extends the UnoAgent class (see agents/unoagent.py) and implements UnoAgent::get_action. Check out agents/textagent.py and agents/randomagent.py for examples.

Testing your agent

Create an instance of your custom agent class and pass it into an UnoEnvironment. See the example in the main function of unoenv.py.

GUI

A GUI made with Svelte and Flask can be found inside the gui-folder. It can be used to visualize an UNO-game. To start the backend you first have to run

flask --app gui.unoserver run

from the root-folder of the project. After this, open a new terminal and run

cd gui
npm install
npm run dev

and head to http://localhost:5173. This will by default start a simulation of an UNO-game with 10 agents doing random actions every time you refresh thr browser window. To change the competing agents you have to change the agents inside the listen-function inside gui/unoserver.py and restart the server.

artificial-uno's People

Contributors

dymbe avatar titaenstad 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.