209 lines
4.6 KiB
Org Mode
209 lines
4.6 KiB
Org Mode
:PROPERTIES:
|
|
:ID: e79ad4ee-17d0-44f9-8270-2f19b65bc949
|
|
:END:
|
|
#+title: Tutor
|
|
|
|
A [[id:cda9c620-fec5-4549-b979-22fc06819d77][Python]] application backed by a SQLite database for tracking my [[id:d5efa5bd-dac9-4ef5-b352-a2b794a37bd0][Magic: The
|
|
Gathering]] card collection.
|
|
|
|
https://git.phoenixinquis.net/correlr/tutor
|
|
|
|
* Finding cards for a deck
|
|
Decklist -- Alive -- Shared via TopDecked MTG
|
|
Main (100)
|
|
1 Serra Ascendant
|
|
1 Soul's Attendant
|
|
1 Ajani's Pridemate
|
|
1 Alabaster Mage
|
|
1 Grateful Apparition
|
|
1 Suture Priest
|
|
1 Trelasarra, Moon Dancer
|
|
1 Angel of Vitality
|
|
1 Celestial Unicorn
|
|
1 Evolution Sage
|
|
1 Lurking Roper
|
|
1 Spike Feeder
|
|
1 Splendor Mare
|
|
1 Armorcraft Judge
|
|
1 Bloom Hulk
|
|
1 Core Prowler
|
|
1 Lathiel, the Bounteous Dawn
|
|
1 Lightkeeper of Emeria
|
|
1 Hamza, Guardian of Arashin
|
|
1 Ajani Goldmane
|
|
1 The Wanderer
|
|
1 Blossoming Wreath
|
|
1 Condemn
|
|
1 Fortifying Draught
|
|
1 Healing Salve
|
|
1 Light of Hope
|
|
1 Divine Offering
|
|
1 Revitalize
|
|
1 Abuna's Chant
|
|
1 Angel's Mercy
|
|
1 Blunt the Assault
|
|
1 Congregate
|
|
1 Refreshing Rain
|
|
1 War Report
|
|
1 Corrosive Gale
|
|
1 Bond of Flourishing
|
|
1 Courage in Crisis
|
|
1 Survival Cache
|
|
1 Hunters' Feast
|
|
1 Primal Command
|
|
1 Wanderer's Strike
|
|
1 Planewide Celebration
|
|
1 Fountain of Youth
|
|
1 Elixir of Immortality
|
|
1 Golden Urn
|
|
1 Sol Ring
|
|
1 Soul Net
|
|
1 The Ozolith
|
|
1 Contagion Clasp
|
|
1 Throne of Geth
|
|
1 Marble Chalice
|
|
1 Staff of Domination
|
|
1 Soul Conduit
|
|
1 Lifelink
|
|
1 Spirit Link
|
|
1 Ajani's Mantra
|
|
1 Inner Sanctum
|
|
1 Luminous Wake
|
|
1 Faith's Fetters
|
|
1 First Response
|
|
1 Vigil for the Lost
|
|
1 Noble Purpose
|
|
1 Noble Stand
|
|
1 Celestial Mantle
|
|
1 Blossoming Sands
|
|
1 Command Tower
|
|
14 Forest
|
|
1 Karn's Bastion
|
|
16 Plains
|
|
1 Razorverge Thicket
|
|
1 Sunpetal Grove
|
|
1 Yavimaya Hollow
|
|
|
|
|
|
|
|
Shared via TopDecked MTG
|
|
|
|
|
|
https://www.topdecked.com/decks/alive/833c308f-219f-4624-8b32-1adedcb477f0
|
|
|
|
#+caption: Adding the deck list to the database
|
|
#+begin_src sql :exports code :eval never
|
|
INSERT INTO decks (deck_id, name) VALUES (2, 'Alive');
|
|
|
|
INSERT INTO deck_cards (deck_id, oracle_id)
|
|
SELECT DISTINCT 2, oracle_id FROM cards WHERE name IN
|
|
(
|
|
'Serra Ascendant',
|
|
'Soul''s Attendant',
|
|
'Ajani''s Pridemate',
|
|
'Alabaster Mage',
|
|
'Grateful Apparition',
|
|
'Suture Priest',
|
|
'Trelasarra, Moon Dancer',
|
|
'Angel of Vitality',
|
|
'Celestial Unicorn',
|
|
'Evolution Sage',
|
|
'Lurking Roper',
|
|
'Spike Feeder',
|
|
'Splendor Mare',
|
|
'Armorcraft Judge',
|
|
'Bloom Hulk',
|
|
'Core Prowler',
|
|
'Lathiel, the Bounteous Dawn',
|
|
'Lightkeeper of Emeria',
|
|
'Hamza, Guardian of Arashin',
|
|
'Ajani Goldmane',
|
|
'The Wanderer',
|
|
'Blossoming Wreath',
|
|
'Condemn',
|
|
'Fortifying Draught',
|
|
'Healing Salve',
|
|
'Light of Hope',
|
|
'Divine Offering',
|
|
'Revitalize',
|
|
'Abuna''s Chant',
|
|
'Angel''s Mercy',
|
|
'Blunt the Assault',
|
|
'Congregate',
|
|
'Refreshing Rain',
|
|
'War Report',
|
|
'Corrosive Gale',
|
|
'Bond of Flourishing',
|
|
'Courage in Crisis',
|
|
'Survival Cache',
|
|
'Hunters'' Feast',
|
|
'Primal Command',
|
|
'Wanderer''s Strike',
|
|
'Planewide Celebration',
|
|
'Fountain of Youth',
|
|
'Elixir of Immortality',
|
|
'Golden Urn',
|
|
'Sol Ring',
|
|
'Soul Net',
|
|
'The Ozolith',
|
|
'Contagion Clasp',
|
|
'Throne of Geth',
|
|
'Marble Chalice',
|
|
'Staff of Domination',
|
|
'Soul Conduit',
|
|
'Lifelink',
|
|
'Spirit Link',
|
|
'Ajani''s Mantra',
|
|
'Inner Sanctum',
|
|
'Luminous Wake',
|
|
'Faith''s Fetters',
|
|
'First Response',
|
|
'Vigil for the Lost',
|
|
'Noble Purpose',
|
|
'Noble Stand',
|
|
'Celestial Mantle',
|
|
'Blossoming Sands',
|
|
'Command Tower',
|
|
'Forest',
|
|
'Karn''s Bastion',
|
|
'Plains',
|
|
'Razorverge Thicket',
|
|
'Sunpetal Grove',
|
|
'Yavimaya Hollow'
|
|
);
|
|
#+end_src
|
|
|
|
#+caption: Finding cards in the collection
|
|
#+begin_src sql :exports code :eval never
|
|
select distinct set_code,
|
|
color_identity,
|
|
cards.name,
|
|
sets.name,
|
|
type_line,
|
|
rarity
|
|
from deck_cards
|
|
join cards using(oracle_id)
|
|
join copies using (scryfall_id)
|
|
join rarities using (rarity)
|
|
join sets using(set_code)
|
|
where deck_id = 2
|
|
order by release_date desc, color_identity, rarity_ord desc, cards.name;
|
|
#+end_src
|
|
|
|
** Questions
|
|
- Where are the cards in my collection I need to build a deck?
|
|
- Which cards do I want in one deck that are currently in another?
|
|
- Which cards do I need more copies of?
|
|
- Which cards do I need that would improve specific decks?
|
|
|
|
** Types
|
|
: import Text -> (ValidCardNames, InvalidCardNames)
|
|
: import Text -> (ValidCards, InvalidCards)
|
|
|
|
: PreferredCard = PreferredCard { name: ValidCardName, card: Maybe ValidCard }
|
|
: import Text -> ([PreferredCard], [InvalidCardNames])
|
|
|
|
: decklist DeckName -> ValidCardNames -> DeckList
|
|
: commanderDeckList -> DeckList -> Either InvalidCommanderDeck CommanderDecklist
|
|
|
|
: Deck = Deck [PreferredCard]
|