Giter Site home page Giter Site logo

curvefishing's Introduction

curvefishing

The game Magic: the Gathering consists of playing lands, which allow a player to cast spells to play against another player. This package uses a simplified simulation engine to goldfish for the mana curve.

# install devtools for devtools::install_github
install.packages("devtools")
library(devtools)
# install curvefishing
install_github("CSJCampbell/curvefishing/curvefishing")

The input to the package tools are deck data frames with column names:

  • type: character column with values "land" and "spell"
  • cost: character column with WUBRG mana costs, e.g. "1WUB"
  • number: optional numeric column, number of cards to include in deck, e.g. 4

To estimate the fish metric for a deck, the go_fish function will expand decklists with the number column, then shuffle and analyse the first 7 turns for opportunities to play.

library(dplyr)
library(curvefishing)
rock <- tribble(
  ~number,            ~name,   ~type, ~cost, ~is_tapped,
  4,    "Birds of Paradise", "spell",   "G", FALSE,
  1,       "Llanowar Elves", "spell",   "G", FALSE,
  4,         "Albino Troll", "spell",  "1G", FALSE,
  3,       "Yavimaya Elder", "spell", "1GG", FALSE,
  4,     "Yavimaya Granger", "spell",  "2G", FALSE,
  4,      "Deranged Hermit", "spell", "3GG", FALSE,
  1,           "Woodripper", "spell", "3GG", FALSE,
  4, "Phyrexian Plaguelord", "spell", "3BB", FALSE,
  4,               "Duress", "spell",   "B", FALSE,
  2,       "Vampiric Tutor", "spell",   "B", FALSE,
  1,       "Tranquil Grove", "spell",  "1G", FALSE,
  3,          "Rapid Decay", "spell",  "1B", FALSE,
  2,   "Diabolic Servitude", "spell", "3BB", FALSE,
  4,      "Treetop Village",  "land",   "G",  TRUE,
  2,            "Dust Bowl",  "land",   "1", FALSE,
  6,                "Swamp",  "land",   "B", FALSE,
 11,               "Forest",  "land",   "G", FALSE)
f1 <- go_fish(decklist = rock)
f1
# ><>
#  14
plot(f1)

Turn 7 curve fish for the rock

Note that spells are not played, so no costs can be paid by spells, and no additional cards drawn.

curvefishing's People

Contributors

csjcampbell 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.