Git Product home page Git Product logo

magic-the-gathering-python's People

Contributors

gcoter avatar

Watchers

 avatar  avatar

magic-the-gathering-python's Issues

Create a Hello World file

In the magic_the_gathering folder, create a file hello_world.py and implement a for loop printing all numbers from 0 to 10 (except 7). Add a section in README.md about how to execute hello_world.py.

Create classes for objects

Objects are instantiated by blueprints

PermanentObject
--> TokenObject
NonPermanentObject

PermanentObject instances have an ObjectState

Improve the stack usage

For now, the stack is only used during the MainPhase. However:

The stack can get used and resolved basically anytime players can get priority, and resolve one element at a time
#24 (comment)

Also, the elements of the stack should be resolved one element at a time and players should pass successively to pass to the next resolution

Add ability to evaluate a game state

Add the ability for a game state to be evaluated from the perspective of each player.

The score could be a function of my creatures, my lands in play, my cards in hand, my life total VS my opponent's.
Additional ideas:

  • the land number 10 is much less valuable than the number 1, whether in hand or in play
  • the creature number 10 might be less valuable in play than the first, because of wraths
  • life isn't that relevant, except when it gets low
  • the generic value of a card in hand depends on the number of cards in that hand and in the opponent's hand: I am happy to make everyone discard 1 card if I have 7 and opp has 1. Similar for the board with making everyone sacrifice one creature. Similar for lands in play.
  • The value of a permanent depends on its status in addition to its stats. Ex: a tapped creature is slightly worse than untapped, much worse if low hp.

Note: this function cannot use information hidden from said player. This can be as simple as not using the attributes of cards in the opponent's hand for now, latter let's have a players_this_card_has_been_revealed_to attribute.

[Bug] Endless game

When I try to dvc repro, I get stuck at the collect_data phase. It looks in some conditions, the game runs infinitely. It is difficult to reproduce because it happens randomly. For instance, 40 games can run without problem and then suddenly the next one turns endlessly. It is probably linked to one of the changes in #65

Add a test script for combat

Combat is a tricky part of Magic, it would be nice to be able to simulate combats with specific cards chosen by us instead of running a entire game each time

Create a class for player actions

  • Play a land
  • Casting a card
  • Activating an activated ability
  • Paying cost
  • Choosing target
  • Choosing a card (for instance when we have to discard some cards)

Attach a state to permanents

For instance, is_tapped should be part of this state. The state should be set when we create an object from a given card.

Implement filters

Filtering cards according to criterias is quite common in Magic, it would be nice to have to have classes for that

List possible actions

It depends on:

  • Do players have priority?
  • Are we in the main phase and the stack is empty?

Make it possible to save all the data related to a game

When running a game, we could create a folder run-{uuid}/ and for each action write a JSON file action-{i}.json with a structure like this:

{
    "game_state": {The full `GameState` *before* the action is executed},
    "action": {The `Action` being executed}
}

At the end of the game, one final JSON file results.json could record the results of the game, something like:

{
    "winner_player_index": 1,
    ...
}

Implement a RandomPlayer

Implement an AI player which just chooses one legal option at random each time it has priority

Add Summoning Sickness

Set a flag to True when we cast a creature, set it to False at the beginning of the turn for creatures on the battlefield.

For a complete implementation, we should also consider changes of controllers. Also, we should generalize it to all permanent as non-creatures can become creatures.

Create a class for triggers

A Trigger has a list of TriggerCondition and can create TriggerEffect when the conditions are met. Trigger and TriggerEffect are added on the stack.

Add a GUI

Either using something like tkinter or as a web app (developped with Vue.js for instance). The GUI should display the game state at any point in the game and allow the current player to pick one action among the possible ones.

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.