Giter VIP home page Giter VIP logo

mtg-draft-ai's Introduction

Notes & Discussion

Developer Setup

Prerequisites

  • Python 3.4 or above
  • Python environment manager (optional but recommended). One of:
    • virtualenv
    • conda
  • Pip
    • Pip comes with virtualenv/conda. Otherwise, make sure it's installed on your system Python 3.

If you are not using virtualenv or conda, check to make sure your python and pip are both pointing to Python 3 before proceeding, by running:

python --version
pip --version

Example virtualenv setup (run inside project root)

virtualenv --python=python3 venv

Creates a new virtual environment stored in a new directory called venv in the project root. --python=python3 may not be necessary if you only have python3 installed on your system and not python2 as well.

source venv/bin/activate

Activates the virtual environment. You should always have the virtualenv active in your shell when running the tests or site.

Setup

  1. cd into python project root
  2. If using env manager, create a new environment, or activate your existing one
  3. Run pip install -e ".[test]"
    • -e installs in "editable mode" - changes to your source files will automatically be used without needing to install again
    • [test] makes pip install the test dependencies as well

You can now run python scripts which use files from this project, e.g.:

python trials.py 1

Running Tests

Run all tests:

pytest

Run tests in specific file(s):

pytest tests/test_api.py

Run test with specific name:

pytest -k test_drafter_pick

Run tests and generate coverage report:

(Other options for --cov-report are available, e.g. html)

pytest --cov=mtg_draft_ai --cov-report term-missing

Running the site locally

1-time setup:

cd website/draft_site
python manage.py migrate

Start the site:

python manage.py runserver

Notebooks

Code used for trying out ideas for the AI / generating visualizations / etc.

See notebooks

mtg-draft-ai's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mtg-draft-ai's Issues

Better logging

Currently the extent of our logging is just prints to the console or a file; it would be nice to have a logging interface which implements the standard trace-debug-info-warn-error granularity level, and which writes metadata about where and when it was logged automatically.

Current tag system is limited

The limitations of our current tag system are already likely to throw the bots off the scent of correct drafting. There are a number of ways to improve this; I will likely start with an investigation into compound tags:

Compound tags - tags which require multiple tokens in order to draw their vertices, ex, Heroic&Tokens may count toward heroic and tokens vertices, but only if you have both. This could potentially benefit from weighted vertices; Anax and Cymede, could have both "Heroic - Payoff" and "Heroic&Tokens - Payoff", causing Heroic to be counted twice in the scenario in which heroic and token cards are counted.

Reduce storage needed in DB for each draft

I think most of the data stored in the DB for each draft comes from the serialized bot state:

db_drafter.bot_state = pickle.dumps(drafter)

It's large because it's using pickle to serialize right now, which probably isn't a good idea in general. This might not even be needed at all, as the relevant data can be reconstructed from the data that's already in the DB, and we want to avoid having the bot algorithms rely on their own proprietary state for now.

Hybrid Mana

Should allow bot to understand that hybrid cards can be played with only one of the two colors.

Signets can also be counted as hybrid color identity, possibly.

Use specific versions of cards for images

Cubecobra contains info on which version of the card in its export. We should use this to show the correct card image on the website, instead of just looking it up from scryfall by name.

Dark mode

A few users are interested in dark mode, seems like an easy fix.

Allow multiple packs to queue up

In real life (casual rules) you can pick from a pack as soon as it's passed to you, and multiple packs can queue up on a person. Seems like we should support this too. Should also show information on how many packs are waiting on each person.

Add option to confirm picks

AS A Drafter
I WANT to confirm my pick
SO THAT I don't ruin a draft with a mis-click

AS A Drafter who doesn't constantly click randomly
I WANT to be able to pick in a single click
SO THAT I can draft in fewer clicks

Option to zoom in on cards while drafting

Some users have difficulty reading the text on cards while drafting. In most draft clients, there is a feature to zoom in on a card while hovering over it to mitigate this issue.

Draft stats

In general it'd be cool to get data on what people are picking. This could help on deciding when to cut cards because they're never picked. Some basic ideas to get started:

  • Average pick # for each card.
  • Options to only show stats for human drafters, and/or only for drafts with >50% human drafters.

Add support for multiple cubes

Would still use local files and configuration for now.

Bot AI will be bad for Galaxy Brain Cube but that's fine for all human drafts.

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.