All of us have been playing Magic: the Gathering game for about a year, and we saw need for judging mechanism that was unbiased.

What it does

This program gets a start state and a transition and determines if a legal game state can be reached with the given transition. In laymen's terms, it checks to see if a move is legal or not given the rules of a game.

How we built it

We had to make record types to represent the variety of state components in a game of Magic. Notably, game-state keeps track of the order and location of cards in various game zones and player attributes. Unfortunately, Magic is a very complex game ( The Comprehensive Rules ), so we didn't get much further than implementing the type system before we ran out of time.

Challenges we ran into

s(ASP) doesn't have types or provide many of the prolog built-ins we had hoped to use, which greatly increased the rate of code duplication that we faced. Additionally, the unification operator did not work as we initially thought, which produced some very interesting debugging challenges in our last few hours of work.

Accomplishments that we're proud of

We implemented a relatively stable type system in s(ASP).

What we learned

The unification operator, when used in predicates, can cause the predicate to appear to succeed even if the values being unified with a variable is malformed. In particular, this means that attempts to use it when evaluating data types will fail spectacularly unless the unified value is then asserted to be true.

What's next for Hack_AI_MTG

We would like to implement more cards to expand the program's ability to process different changes in game state. Current functionality is limited to drawing, discarding, and validating game states.

Built With

  • s(asp)
Share this project: