GithubHelp home page GithubHelp logo

pinky39 / grove Goto Github PK

View Code? Open in Web Editor NEW
114.0 12.0 16.0 38.84 MB

A computer implementation of a trading card game: Magic: The Gathering. The goal of the project is to implement ai algorithms which can play the game at the same level as a casual human player.

License: GNU General Public License v3.0

PowerShell 0.09% C# 99.84% Smalltalk 0.04% Batchfile 0.03%
magic-the-gathering artificial-intelligence csharp game min-max

grove's People

Contributors

antonshcherbakov avatar brookesb91 avatar pinky39 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grove's Issues

Dragonscale General

In the Unflinching Assault deck, Dragonscale General's ability triggers even if it isn't on the battlefield (i.e. it happens each turn automatically). Not sure how to correct this. Any ideas? Thanks.

i am aware this is not the purpose of issues

but this project is amazing and thanks for all the great work

for fun, i was making a small program that tries to brute force the optimal tron build, and it was really cool to see how someone else did a similar (if FAR more expansive thing)

id have just emailed you but am dumb and couldnt find it

feel free to delete this

Akroma, Angel of Wrath

Good Afternoon Pinky,

I downloaded the Zip file and followed your directions for creating this card: Akroma, Angel of Wrath from the Adding-cards-part-1 text file. I found it had issues with:
using Gameplay.Abilities;
using Gameplay.Characteristics;
using Gameplay.Misc;

Do these systems not work anymore? I added the text solution I went with below is this Ok? I tested it playing a match and I noticed Vigilance, and Haste worked, but I was unable to test it further in game play. I did see your example for testing it without playing the game in Adding-cards-part-1 is this how you still do it?

AkromaAngelOfWrath.txt

I also noticed you have made major changes to this game through 2015. Do I have the most up to date version 3.0? If not, would it be possible to get the most updated version?

I am absolutely obsessed with this project, I have been looking for guidance on on how to create a game like this for years. I found here way more than I ever thought possible. I am basically a Junior Developer looking to get better at coding this type of game. I can't thank you enough for what I have received.

I am very appreciative of your hard work and I feel your like a mentor to me just by being able to study this project and see how things work. Thank you so much, this is one of the best gifts I've ever received in my life.

Sincerely,
Jeff

trouble building due to costura error

Trying to build this project on vs 2015 results in:

Costura: Failed to extract target assembly path from the BuildEngine.
Please raise a bug here http://code.google.com/p/costura/issues/list with the below exception text.
The temporary work-around is to change the weaving task as follows
<EmbedTask ... TargetPath="@(TargetPath)" />
Exception details: System.Exception: Could not extract targetBuilderCallback from Microsoft.Build.BackEnd.TaskHost
at BuildEnginePropertyExtractor.GetProjectInstance() in d:\Builds\Costura\Costura\BuildEnginePropertyExtractor.cs:line 36
at BuildEnginePropertyExtractor.GetEnvironmentVariable(String key, Boolean throwIfNotFound) in d:\Builds\Costura\Costura\BuildEnginePropertyExtractor.cs:line 60
at TargetPathFinder.Execute() in d:\Builds\Costura\Costura\TargetPathFinder.cs:line 28. Project: Grove

I'd like to pick up development for this one if you are agreeable, but I'll need to have my toolchain able to build it first. Any help you can provide?

UI Preview Window resizing

Not sure if this is right place to ask, but are there any options for increasing the size of the preview window in the UI and/or making the text larger? The text is sometimes very hard to read even in thehover preview window. I'm using the default card images, i.e. not real card pictures.

Excellent AI btw - frequently a very cunning opponent!

How to add a card which uses both cost and effect targets

Sorry - this may not be the right place to post this. My apologies in advance. I have your base code and was trying to add Mind Over Matter. For some reason, when I add this card, the very next turn the game tries to evaluate DiscardTarget(), even though I haven't even tried to place the ability on the stack. I have added 0 Effects, Costs or Modifiers to the game so I don't believe I have broken anything in that regard.

My Mind Over Matter Implementation:

namespace Grove.CardsLibrary
{
  using System.Collections.Generic;
  using Grove.Effects;
  using Grove.AI.TimingRules;
  using Grove.Costs;
  using Grove.AI.TargetingRules;

  public class MindOverMatter : CardTemplateSource
  {
    public override IEnumerable<CardTemplate> GetCards()
    {
      yield return Card
        .Named("Mind Over Matter")
        .ManaCost("{2}{U}{U}{U}{U}")
        .Type("Enchantment")
        .Text("Choose and discard a card: Tap or untap target artifact, creature, or land.")
        .FlavorText("Lyna turned to the figure beside her.{EOL}\"They're gone. What now?\"{EOL}\"As ever,\" said Urza, \"we wait.\"")
        .Cast(p => p.TimingRule(new OnSecondMain()))
        .ActivatedAbility(p =>
        {
          p.Text = "Choose and discard a card: Tap target artifact, creature, or land.";

          p.Cost = new DiscardTarget();

          p.Effect = () => new TapTargets();

          p.TargetSelector.AddCost(
            trg => trg.Is.Card().In.OwnersHand(),
            trg => trg.Message = "Select a card to discard.");

          p.TargetSelector.AddEffect(
            trg => trg.Is.Card(card => card.Is().Creature || card.Is().Land || card.Is().Artifact).On.Battlefield(),
            trg => trg.Message = "Select a creature, land or artifact to tap.");

          p.TimingRule(new OnStep(Step.BeginningOfCombat));

        })
        .ActivatedAbility(p =>
        {
          p.Text = "Choose and discard a card: Untap target artifact, creature, or land.";
          
          p.Cost = new DiscardTarget();

          p.Effect = () => new UntapTargetPermanents();

          p.TargetSelector.AddCost(
            trg => trg.Is.Card().In.OwnersHand(),
            trg => trg.Message = "Select a card to discard.");

          p.TargetSelector.AddEffect(
            trg => trg.Is.Card(card => card.Is().Creature || card.Is().Land || card.Is().Artifact).On.Battlefield(),
            trg => trg.Message = "Select a creature, land or artifact to untap.");

          p.TimingRule(new Any(
              new OnFirstMain(),
              new AfterOpponentDeclaresAttackers()));

          p.TargetingRule(new EffectUntapPermanent());

        });
    }
  }
}

System.NullReferenceException: Object reference not set to an instance of an object.
at Grove.Costs.DiscardTarget.PayPartial(PayCostParameters p) in \grove-master\source\Grove\Core\Costs\DiscardTarget.cs:line 15 is the first raised error in the debug dump, which is also where the debugger points when running it through debug. It happens when evaluating void PayPartial (because card is never set, since I didn't activate the ability, and thus the cost was never selected. What I'm confused about is why PayPartial is even firing at the time, since I didn't activate the ability?

I built a test deck with Necromancer's Stockpile which also features a DiscardTarget cost (admittedly an Aggregate cost so not exactly apples to apples here) and that did not run into the same error, so clearly I'm doing something wrong. I do note further in the error dump, the message of: "Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Trying to modify a locked change tracker. This is a common indication of an incorrect object copy.". In your stack overflow question you link to from the readme in the project, you state how the engine needs a way to copy the game state for AI purposes, though if that is what is happening here and raising the exception, I'm again lost as to why.

I know this is a huge ask, and totally not your responsibility, but if possible, would you please let me know what I'm doing wrong here and why this might be happening? I'm hopeful that this is something that is glaringly obvious to you since you're intimately familiar with the card implementation. Thank you in advance for your time.

Full error dump here: error.txt

Basic Land Numbering

I am gradually adding my own card images to the game to improve the playing experience even more. However, there is a problem with basic lands. Following the wiki, I have included several images - e.g. forest1.jpg, forest2.jpg. But no matter how many images I include, some still show up blank in game. I am up to forest15.jpg now. How many do I need to have to guarantee that every land will have an image on it? Or maybe I am labelling them incorrectly. Thanks for any suggestions!

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.