simplify the row printing code. further simplification to follow.

This commit is contained in:
Lumen Keyes 2024-08-28 22:21:00 -06:00
parent bce9733d46
commit 038dd4d78a
5 changed files with 228 additions and 243 deletions

4
.gitignore vendored
View File

@ -1,4 +1,8 @@
zig-cache/
zig-out/
zig-out
hyperfine*
strace*
output.pdf
.zig-cache/
oracle-data/*

View File

@ -21,8 +21,11 @@ pub fn build(b: *std.Build) void {
exe.linkLibC();
exe.root_module.addImport("grapheme", zg.module("grapheme"));
exe.root_module.addImport("DisplayWidth", zg.module("DisplayWidth"));
const zigJsonDependency = b.dependency("zig-json", .{});
const clap = b.dependency("clap", .{});
exe.root_module.addImport("clap", clap.module("clap"));
exe.root_module.addImport("json", zigJsonDependency.module("zig-json"));
b.installArtifact(exe);

View File

@ -23,6 +23,10 @@
.url = "git+https://github.com/Hejsil/zig-clap#c0193e9247335a6c1688b946325060289405de2a",
.hash = "12207ee987ce045596cb992cfb15b0d6d9456e50d4721c3061c69dabc2962053644d",
},
.@"zig-json" = .{
.url = "https://codeload.github.com/part1zano/zig-json/tar.gz/master",
.hash = "1220aaba53d38fd5689b6a29e496ab8a262c54ae8a52321e61ed8da9f1d968c69e7e",
},
},
.paths = .{
// This makes *all* files, recursively, included in this package. It is generally

View File

@ -3,7 +3,7 @@
1 0 obj
<<
/Creator (My Software )
/CreationDate (D:20240819154405Z)
/CreationDate (D:20240828221626Z)
>>
endobj
2 0 obj
@ -1032,258 +1032,258 @@ BT /GS0 gs 10.000000 696.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg
endstream
endobj
149 0 obj
<< /Length 198 >>stream
BT /GS0 gs 10.000000 684.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Remand {1}{U} \(Instant\) >> |No More Lies {W}{U} |Portent {U} \(Sorcery\) >> ) Tj ET
<< /Length 197 >>stream
BT /GS0 gs 10.000000 684.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Remand {1}{U} \(Instant\) >> |No More Lies {W}{U} |Ice-Fang Coatl {G}{U} \(Snow ) Tj ET
endstream
endobj
150 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 672.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Counter target spell. If |\(Instant\) >> Counter target |Look at the top three cards ) Tj ET
<< /Length 197 >>stream
BT /GS0 gs 10.000000 672.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Counter target spell. If |\(Instant\) >> Counter target |Creature — Snake\) >> Flash ) Tj ET
endstream
endobj
151 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 660.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|that spell is countered this |spell unless its controller |of target player's library, ) Tj ET
BT /GS0 gs 10.000000 660.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|that spell is countered this |spell unless its controller |Flying When ~ enters the ) Tj ET
endstream
endobj
152 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 648.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|way, put it into its owner's |pays {3}. If that spell is |then put them back in any ) Tj ET
BT /GS0 gs 10.000000 648.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|way, put it into its owner's |pays {3}. If that spell is |battlefield, draw a card. ~ ) Tj ET
endstream
endobj
153 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 636.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|hand instead of into that |countered this way, exile it |order. You may have that ) Tj ET
BT /GS0 gs 10.000000 636.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|hand instead of into that |countered this way, exile it |has deathtouch as long as ) Tj ET
endstream
endobj
154 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 624.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|player's graveyard. Draw a |instead of putting it into |player shuffle. Draw a card ) Tj ET
BT /GS0 gs 10.000000 624.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|player's graveyard. Draw a |instead of putting it into |you control at least three ) Tj ET
endstream
endobj
155 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 612.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|card. |its owner's graveyard. |at the beginning of the next ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 612.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|card. |its owner's graveyard. |other snow permanents. \(1/1\) ) Tj ET
endstream
endobj
156 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 600.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | |turn's upkeep. ) Tj ET
BT /GS0 gs 10.000000 600.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
endstream
endobj
157 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 588.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 588.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Portent {U} \(Sorcery\) >> |Snapcaster Mage {1}{U} |Eiganjo, Seat of the Empire ) Tj ET
endstream
endobj
158 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 576.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Ice-Fang Coatl {G}{U} \(Snow |Snapcaster Mage {1}{U} |Eiganjo, Seat of the Empire ) Tj ET
<< /Length 198 >>stream
BT /GS0 gs 10.000000 576.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Look at the top three cards |\(Creature — Human Wizard\) |\(Legendary Land\) >> {T}: Add ) Tj ET
endstream
endobj
159 0 obj
<< /Length 199 >>stream
BT /GS0 gs 10.000000 564.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Creature — Snake\) >> Flash |\(Creature — Human Wizard\) |\(Legendary Land\) >> {T}: Add ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 564.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|of target player's library, |>> Flash When ~ enters the |{W}. Channel — {2}{W}, ) Tj ET
endstream
endobj
160 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 552.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Flying When ~ enters the |>> Flash When ~ enters the |{W}. Channel — {2}{W}, ) Tj ET
BT /GS0 gs 10.000000 552.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|then put them back in any |battlefield, target instant |Discard ~: It deals 4 damage ) Tj ET
endstream
endobj
161 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 540.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield, draw a card. ~ |battlefield, target instant |Discard ~: It deals 4 damage ) Tj ET
BT /GS0 gs 10.000000 540.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|order. You may have that |or sorcery card in your |to target attacking or ) Tj ET
endstream
endobj
162 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 528.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|has deathtouch as long as |or sorcery card in your |to target attacking or ) Tj ET
BT /GS0 gs 10.000000 528.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|player shuffle. Draw a card |graveyard gains flashback |blocking creature. This ) Tj ET
endstream
endobj
163 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 516.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|you control at least three |graveyard gains flashback |blocking creature. This ) Tj ET
BT /GS0 gs 10.000000 516.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|at the beginning of the next |until end of turn. The |ability costs {1} less to ) Tj ET
endstream
endobj
164 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 504.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|other snow permanents. \(1/1\) |until end of turn. The |ability costs {1} less to ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 504.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|turn's upkeep. |flashback cost is equal to |activate for each legendary ) Tj ET
endstream
endobj
165 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 492.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| |flashback cost is equal to |activate for each legendary ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 492.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| |its mana cost. \(2/1\) |creature you control. ) Tj ET
endstream
endobj
166 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 480.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| |its mana cost. \(2/1\) |creature you control. ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 480.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
endstream
endobj
167 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 468.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
<< /Length 195 >>stream
BT /GS0 gs 10.000000 468.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Cosmic Rebirth {1}{G}{W} |Mystic Sanctuary \(Land — |Seasoned Dungeoneer {3}{W} ) Tj ET
endstream
endobj
168 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 456.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Cosmic Rebirth {1}{G}{W} |Mystic Sanctuary \(Land — |Seasoned Dungeoneer {3}{W} ) Tj ET
<< /Length 199 >>stream
BT /GS0 gs 10.000000 456.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Instant\) >> Choose target |Island\) >> ~ enters the |\(Creature — Human Warrior\) ) Tj ET
endstream
endobj
169 0 obj
<< /Length 199 >>stream
BT /GS0 gs 10.000000 444.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Instant\) >> Choose target |Island\) >> ~ enters the |\(Creature — Human Warrior\) ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 444.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|permanent card in your |battlefield tapped unless |>> When ~ enters the ) Tj ET
endstream
endobj
170 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 432.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|permanent card in your |battlefield tapped unless |>> When ~ enters the ) Tj ET
BT /GS0 gs 10.000000 432.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|graveyard. If it has mana |you control three or more |battlefield, you take the ) Tj ET
endstream
endobj
171 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 420.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|graveyard. If it has mana |you control three or more |battlefield, you take the ) Tj ET
BT /GS0 gs 10.000000 420.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|value 3 or less, you may put |other Islands. When ~ enters |initiative. Whenever you ) Tj ET
endstream
endobj
172 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 408.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|value 3 or less, you may put |other Islands. When ~ enters |initiative. Whenever you ) Tj ET
BT /GS0 gs 10.000000 408.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|it onto the battlefield. If |the battlefield untapped, |attack, target attacking ) Tj ET
endstream
endobj
173 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 396.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|it onto the battlefield. If |the battlefield untapped, |attack, target attacking ) Tj ET
BT /GS0 gs 10.000000 396.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|you don't put it onto the |you may put target instant |Cleric, Rogue, Warrior, or ) Tj ET
endstream
endobj
174 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 384.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|you don't put it onto the |you may put target instant |Cleric, Rogue, Warrior, or ) Tj ET
BT /GS0 gs 10.000000 384.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield, put it into |or sorcery card from your |Wizard gains protection from ) Tj ET
endstream
endobj
175 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 372.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield, put it into |or sorcery card from your |Wizard gains protection from ) Tj ET
BT /GS0 gs 10.000000 372.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|your hand. You gain 3 life. |graveyard on top of your |creatures until end of turn. ) Tj ET
endstream
endobj
176 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 360.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|your hand. You gain 3 life. |graveyard on top of your |creatures until end of turn. ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 360.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| |library. |It explores. \(3/4\) ) Tj ET
endstream
endobj
177 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 348.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| |library. |It explores. \(3/4\) ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 348.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
endstream
endobj
178 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 336.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 336.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Murktide Regent {5}{U}{U} |Shark Typhoon {5}{U} |Field of the Dead \(Land\) >> ) Tj ET
endstream
endobj
179 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 324.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Murktide Regent {5}{U}{U} |Shark Typhoon {5}{U} |Field of the Dead \(Land\) >> ) Tj ET
<< /Length 198 >>stream
BT /GS0 gs 10.000000 324.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Creature — Dragon\) >> |\(Enchantment\) >> Whenever |~ enters the battlefield ) Tj ET
endstream
endobj
180 0 obj
<< /Length 198 >>stream
BT /GS0 gs 10.000000 312.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Creature — Dragon\) >> |\(Enchantment\) >> Whenever |~ enters the battlefield ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 312.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Delve Flying ~ enters the |you cast a noncreature |tapped. {T}: Add {C}. ) Tj ET
endstream
endobj
181 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 300.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Delve Flying ~ enters the |you cast a noncreature |tapped. {T}: Add {C}. ) Tj ET
BT /GS0 gs 10.000000 300.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield with a +1/+1 |spell, create an X/X blue |Whenever ~ or another land ) Tj ET
endstream
endobj
182 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 288.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield with a +1/+1 |spell, create an X/X blue |Whenever ~ or another land ) Tj ET
BT /GS0 gs 10.000000 288.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|counter on it for each |Shark creature token with |enters the battlefield under ) Tj ET
endstream
endobj
183 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 276.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|counter on it for each |Shark creature token with |enters the battlefield under ) Tj ET
BT /GS0 gs 10.000000 276.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|instant and sorcery card |flying, where X is that |your control, if you control ) Tj ET
endstream
endobj
184 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 264.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|instant and sorcery card |flying, where X is that |your control, if you control ) Tj ET
BT /GS0 gs 10.000000 264.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|exiled with it. Whenever an |spell's mana value. Cycling |seven or more lands with ) Tj ET
endstream
endobj
185 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 252.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|exiled with it. Whenever an |spell's mana value. Cycling |seven or more lands with ) Tj ET
BT /GS0 gs 10.000000 252.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|instant or sorcery card |{X}{1}{U} When you cycle ~, |different names, create a ) Tj ET
endstream
endobj
186 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 240.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|instant or sorcery card |{X}{1}{U} When you cycle ~, |different names, create a ) Tj ET
BT /GS0 gs 10.000000 240.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|leaves your graveyard, put a |create an X/X blue Shark |2/2 black Zombie creature ) Tj ET
endstream
endobj
187 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 228.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|leaves your graveyard, put a |create an X/X blue Shark |2/2 black Zombie creature ) Tj ET
<< /Length 196 >>stream
BT /GS0 gs 10.000000 228.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|+1/+1 counter on ~. \(3/3\) |creature token with flying. |token. ) Tj ET
endstream
endobj
188 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 216.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|+1/+1 counter on ~. \(3/3\) |creature token with flying. |token. ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 216.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
endstream
endobj
189 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 204.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
<< /Length 195 >>stream
BT /GS0 gs 10.000000 204.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Planar Genesis {G}{U} |Leyline Binding {5}{W} |Solitude {3}{W}{W} \(Creature ) Tj ET
endstream
endobj
190 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 192.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Planar Genesis {G}{U} |Leyline Binding {5}{W} |Solitude {3}{W}{W} \(Creature ) Tj ET
<< /Length 199 >>stream
BT /GS0 gs 10.000000 192.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Instant\) >> Look at the top |\(Enchantment\) >> Flash |— Elemental Incarnation\) ) Tj ET
endstream
endobj
191 0 obj
<< /Length 199 >>stream
BT /GS0 gs 10.000000 180.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Instant\) >> Look at the top |\(Enchantment\) >> Flash |— Elemental Incarnation\) ) Tj ET
<< /Length 194 >>stream
BT /GS0 gs 10.000000 180.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|four cards of your library. |Domain — This spell costs |>> Flash Lifelink When ~ ) Tj ET
endstream
endobj
192 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 168.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|four cards of your library. |Domain — This spell costs |>> Flash Lifelink When ~ ) Tj ET
BT /GS0 gs 10.000000 168.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|You may put a land card from |{1} less to cast for each |enters the battlefield, ) Tj ET
endstream
endobj
193 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 156.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|You may put a land card from |{1} less to cast for each |enters the battlefield, ) Tj ET
BT /GS0 gs 10.000000 156.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|among them onto the |basic land type among lands |exile up to one other target ) Tj ET
endstream
endobj
194 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 144.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|among them onto the |basic land type among lands |exile up to one other target ) Tj ET
BT /GS0 gs 10.000000 144.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield tapped. If you |you control. When ~ enters |creature. That creature's ) Tj ET
endstream
endobj
195 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 132.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|battlefield tapped. If you |you control. When ~ enters |creature. That creature's ) Tj ET
BT /GS0 gs 10.000000 132.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|don't, put a card from among |the battlefield, exile |controller gains life equal ) Tj ET
endstream
endobj
196 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 120.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|don't, put a card from among |the battlefield, exile |controller gains life equal ) Tj ET
BT /GS0 gs 10.000000 120.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|them into your hand. Put the |target nonland permanent an |to its power. Evoke—Exile ) Tj ET
endstream
endobj
197 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 108.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|them into your hand. Put the |target nonland permanent an |to its power. Evoke—Exile ) Tj ET
BT /GS0 gs 10.000000 108.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|rest on the bottom of your |opponent controls until ~ |a white card from your hand. ) Tj ET
endstream
endobj
198 0 obj
<< /Length 193 >>stream
BT /GS0 gs 10.000000 96.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|rest on the bottom of your |opponent controls until ~ |a white card from your hand. ) Tj ET
<< /Length 195 >>stream
BT /GS0 gs 10.000000 96.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|library in a random order. |leaves the battlefield. |\(3/2\) ) Tj ET
endstream
endobj
199 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 84.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|library in a random order. |leaves the battlefield. |\(3/2\) ) Tj ET
<< /Length 193 >>stream
BT /GS0 gs 10.000000 84.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
endstream
endobj
200 0 obj
@ -1803,7 +1803,6 @@ endobj
299 0 R
300 0 R
301 0 R
302 0 R
]
>>
endobj
@ -1813,147 +1812,142 @@ BT /GS0 gs 10.000000 792.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg
endstream
endobj
275 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 780.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Tamiyo, Inquisitive Student | | ) Tj ET
<< /Length 129 >>stream
BT /GS0 gs 10.000000 780.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Tamiyo, Inquisitive Student ) Tj ET
endstream
endobj
276 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 768.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|{U} \(Legendary Creature — | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 768.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc ({U} \(Legendary Creature — ) Tj ET
endstream
endobj
277 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 756.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Moonfolk Wizard\) >> Flying | | ) Tj ET
<< /Length 129 >>stream
BT /GS0 gs 10.000000 756.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Moonfolk Wizard\) >> Flying ) Tj ET
endstream
endobj
278 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 744.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Whenever ~ attacks, | | ) Tj ET
<< /Length 121 >>stream
BT /GS0 gs 10.000000 744.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Whenever ~ attacks, ) Tj ET
endstream
endobj
279 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 732.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|investigate. When you draw | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 732.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (investigate. When you draw ) Tj ET
endstream
endobj
280 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 720.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|your third card in a turn, | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 720.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (your third card in a turn, ) Tj ET
endstream
endobj
281 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 708.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|exile Tamiyo, then return | | ) Tj ET
<< /Length 127 >>stream
BT /GS0 gs 10.000000 708.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (exile Tamiyo, then return ) Tj ET
endstream
endobj
282 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 696.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|her to the battlefield | | ) Tj ET
<< /Length 124 >>stream
BT /GS0 gs 10.000000 696.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (her to the battlefield ) Tj ET
endstream
endobj
283 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 684.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|transformed under her | | ) Tj ET
<< /Length 123 >>stream
BT /GS0 gs 10.000000 684.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (transformed under her ) Tj ET
endstream
endobj
284 0 obj
<< /Length 196 >>stream
BT /GS0 gs 10.000000 672.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|owner's control. \(0/3\) // | | ) Tj ET
<< /Length 129 >>stream
BT /GS0 gs 10.000000 672.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (owner's control. \(0/3\) // ) Tj ET
endstream
endobj
285 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 660.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Tamiyo, Seasoned Scholar | | ) Tj ET
<< /Length 126 >>stream
BT /GS0 gs 10.000000 660.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Tamiyo, Seasoned Scholar ) Tj ET
endstream
endobj
286 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 648.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|\(Legendary Planeswalker — | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 648.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (\(Legendary Planeswalker — ) Tj ET
endstream
endobj
287 0 obj
<< /Length 195 >>stream
BT /GS0 gs 10.000000 636.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Tamiyo\) >> +2: Until your | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 636.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Tamiyo\) >> +2: Until your ) Tj ET
endstream
endobj
288 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 624.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|next turn, whenever a | | ) Tj ET
<< /Length 123 >>stream
BT /GS0 gs 10.000000 624.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (next turn, whenever a ) Tj ET
endstream
endobj
289 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 612.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|creature attacks you or a | | ) Tj ET
<< /Length 127 >>stream
BT /GS0 gs 10.000000 612.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (creature attacks you or a ) Tj ET
endstream
endobj
290 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 600.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|planeswalker you control, it | | ) Tj ET
<< /Length 130 >>stream
BT /GS0 gs 10.000000 600.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (planeswalker you control, it ) Tj ET
endstream
endobj
291 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 588.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|gets -1/-0 until end of | | ) Tj ET
<< /Length 125 >>stream
BT /GS0 gs 10.000000 588.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (gets -1/-0 until end of ) Tj ET
endstream
endobj
292 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 576.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|turn. 3: Return target | | ) Tj ET
<< /Length 125 >>stream
BT /GS0 gs 10.000000 576.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (turn. 3: Return target ) Tj ET
endstream
endobj
293 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 564.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|instant or sorcery card from | | ) Tj ET
<< /Length 130 >>stream
BT /GS0 gs 10.000000 564.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (instant or sorcery card from ) Tj ET
endstream
endobj
294 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 552.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|your graveyard to your hand. | | ) Tj ET
<< /Length 130 >>stream
BT /GS0 gs 10.000000 552.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (your graveyard to your hand. ) Tj ET
endstream
endobj
295 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 540.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|If it's a green card, add | | ) Tj ET
<< /Length 127 >>stream
BT /GS0 gs 10.000000 540.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (If it's a green card, add ) Tj ET
endstream
endobj
296 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 528.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|one mana of any color. 7: | | ) Tj ET
<< /Length 128 >>stream
BT /GS0 gs 10.000000 528.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (one mana of any color. 7: ) Tj ET
endstream
endobj
297 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 516.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|Draw cards equal to half the | | ) Tj ET
<< /Length 130 >>stream
BT /GS0 gs 10.000000 516.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (Draw cards equal to half the ) Tj ET
endstream
endobj
298 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 504.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|number of cards in your | | ) Tj ET
<< /Length 125 >>stream
BT /GS0 gs 10.000000 504.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (number of cards in your ) Tj ET
endstream
endobj
299 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 492.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|library, rounded up. You get | | ) Tj ET
<< /Length 130 >>stream
BT /GS0 gs 10.000000 492.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (library, rounded up. You get ) Tj ET
endstream
endobj
300 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 480.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|an emblem with "You have no | | ) Tj ET
<< /Length 129 >>stream
BT /GS0 gs 10.000000 480.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (an emblem with "You have no ) Tj ET
endstream
endobj
301 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 468.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (|maximum hand size." [2] | | ) Tj ET
endstream
endobj
302 0 obj
<< /Length 194 >>stream
BT /GS0 gs 10.000000 456.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (| | | ) Tj ET
<< /Length 125 >>stream
BT /GS0 gs 10.000000 468.000000 TD /F2 8.000000 Tf 0.000000 0.000000 0.000000 rg 0.000000 Tc (maximum hand size." [2] ) Tj ET
endstream
endobj
xref
0 303
0 302
0000000000 65535 f
0000000017 00000 n
0000000157 00000 n
@ -2104,26 +2098,26 @@ xref
0000038977 00000 n
0000039228 00000 n
0000039479 00000 n
0000039734 00000 n
0000039733 00000 n
0000039987 00000 n
0000040238 00000 n
0000040489 00000 n
0000040740 00000 n
0000040991 00000 n
0000041242 00000 n
0000041493 00000 n
0000041744 00000 n
0000041996 00000 n
0000042252 00000 n
0000042503 00000 n
0000042754 00000 n
0000043005 00000 n
0000043256 00000 n
0000041244 00000 n
0000041495 00000 n
0000041748 00000 n
0000042003 00000 n
0000042254 00000 n
0000042505 00000 n
0000042756 00000 n
0000043007 00000 n
0000043258 00000 n
0000043509 00000 n
0000043760 00000 n
0000043762 00000 n
0000044013 00000 n
0000044264 00000 n
0000044516 00000 n
0000044265 00000 n
0000044521 00000 n
0000044772 00000 n
0000045023 00000 n
0000045274 00000 n
@ -2131,10 +2125,10 @@ xref
0000045776 00000 n
0000046027 00000 n
0000046278 00000 n
0000046529 00000 n
0000046531 00000 n
0000046782 00000 n
0000047033 00000 n
0000047286 00000 n
0000047035 00000 n
0000047290 00000 n
0000047541 00000 n
0000047792 00000 n
0000048043 00000 n
@ -2142,10 +2136,10 @@ xref
0000048545 00000 n
0000048796 00000 n
0000049047 00000 n
0000049298 00000 n
0000049300 00000 n
0000049551 00000 n
0000049802 00000 n
0000050054 00000 n
0000049803 00000 n
0000050059 00000 n
0000050310 00000 n
0000050561 00000 n
0000050812 00000 n
@ -2153,7 +2147,7 @@ xref
0000051314 00000 n
0000051565 00000 n
0000051816 00000 n
0000052066 00000 n
0000052068 00000 n
0000052318 00000 n
0000052568 00000 n
0000052818 00000 n
@ -2228,42 +2222,41 @@ xref
0000071194 00000 n
0000071444 00000 n
0000071694 00000 n
0000072649 00000 n
0000072900 00000 n
0000073151 00000 n
0000073403 00000 n
0000073655 00000 n
0000073906 00000 n
0000074157 00000 n
0000074408 00000 n
0000074659 00000 n
0000072640 00000 n
0000072891 00000 n
0000073077 00000 n
0000073262 00000 n
0000073448 00000 n
0000073626 00000 n
0000073811 00000 n
0000073996 00000 n
0000074180 00000 n
0000074361 00000 n
0000074541 00000 n
0000074727 00000 n
0000074910 00000 n
0000075161 00000 n
0000075414 00000 n
0000075665 00000 n
0000075917 00000 n
0000076169 00000 n
0000076420 00000 n
0000076671 00000 n
0000076922 00000 n
0000077173 00000 n
0000077424 00000 n
0000077675 00000 n
0000077926 00000 n
0000078177 00000 n
0000078428 00000 n
0000078679 00000 n
0000078930 00000 n
0000079181 00000 n
0000079432 00000 n
0000079683 00000 n
0000075095 00000 n
0000075280 00000 n
0000075460 00000 n
0000075644 00000 n
0000075831 00000 n
0000076013 00000 n
0000076195 00000 n
0000076382 00000 n
0000076569 00000 n
0000076753 00000 n
0000076938 00000 n
0000077125 00000 n
0000077307 00000 n
0000077494 00000 n
0000077680 00000 n
trailer
<<
/Size 303
/Size 302
/Root 3 0 R
/Info 1 0 R
/ID [<b756483aba75cb8c> <001ae99317f9d2cf>]
/ID [<d7bc7353a448020b> <001ae4415ceae7ea>]
>>
startxref
79934
77862
%%EOF

View File

@ -12,6 +12,7 @@ const clap = @import("clap");
// https://codeberg.org/dude_the_builder/zg
const DisplayWidth = @import("DisplayWidth");
// https://github.com/AndreRenaud/PDFGen
// including the header file only works for a full build, "zig run" can't find it
const c = @cImport({
@ -20,11 +21,12 @@ const c = @cImport({
const print = std.debug.print;
const io = std.io;
const fs = std.fs;
const json = std.json;
// const json = std.json;
const cwd = fs.cwd();
const indexOf = std.mem.indexOf;
const expect = std.testing.expect;
const assert = std.debug.assert;
const json = std.json;
const Card = struct {
name: []const u8 = "", //string
@ -92,6 +94,7 @@ pub fn main() !void {
}) catch |err| {
return err;
};
if(res.args.listFile) |name| {
listFileName = name;
} else {
@ -101,7 +104,7 @@ pub fn main() !void {
constantHeight = std.mem.eql(u8, choice, "true");
}
var timer = try std.time.Timer.start();
// var timer = try std.time.Timer.start();
const oracleFileSize = (try cwd.statFile(oracleFileName)).size;
const oracleFile = try cwd.readFileAlloc(allocator, oracleFileName, oracleFileSize);
const parsedJson = try json.parseFromSlice([]Card, allocator, oracleFile, .{ .ignore_unknown_fields = true });
@ -115,7 +118,6 @@ pub fn main() !void {
const cardName = line[indexOf(u8, line, " ").? + 1 .. indexOf(u8, line, "(").? - 1];
try cardNames.insert(cardName);
}
print("{d}\n", .{timer.read() / 1_000_000_000});
var cards = std.StringArrayHashMap(TextCard).init(allocator);
for (parsedJson.value) |*cardObj| {
@ -139,9 +141,6 @@ pub fn main() !void {
}
} else {
try cardRow.print(allocator, rowToPrint.items, &allPrinted);
for (allPrinted.items) |printLine| {
print("{s}", .{printLine});
}
rowToPrint.clearAndFree();
}
var page = c.pdf_append_page(pdf_doc);
@ -177,25 +176,18 @@ fn card(
var finalOracleText: [30 * 100]u8 = undefined;
_ = std.mem.replace(u8, oracleBuf.items, cardObj.name, "~", &finalOracleText);
print("{s}\n", .{finalOracleText});
// print("{s}\n", .{finalOracleText});
if (cardObj.card_faces == null or cardObj.isFace) {
try fullUnformattedText.appendSlice(try std.mem.concat(allocator, u8, &[_][]const u8{
cardObj.name,
if (cardObj.mana_cost.len > 0) " " else "",
cardObj.mana_cost,
" (",
cardObj.type_line,
") >> ",
try std.fmt.allocPrint(allocator, " ({s}) >> ", .{cardObj.type_line}),
&finalOracleText,
if (cardObj.power) |_| " (" else "",
cardObj.power orelse "",
if (cardObj.power) |_| "/" else "",
cardObj.toughness orelse "",
if (cardObj.power) |_| ") " else "",
if(cardObj.loyalty) |_| "[" else "",
cardObj.loyalty orelse "",
if(cardObj.loyalty) |_| "]" else "",
if(cardObj.power) |_| try std.fmt.allocPrint(allocator, "({s}/{s})", .{cardObj.power.?, cardObj.toughness.?}) else "",
if(cardObj.loyalty) |_| try std.fmt.allocPrint(allocator, "[{s}]", .{cardObj.loyalty.?}) else ""
}));
}
@ -220,8 +212,8 @@ fn card(
if(word.len > 0) {
try line.appendSlice(word);
try line.append(' ');
print("{any}\n", .{word});
print("{s}\n", .{line.items});
// print("{any}\n", .{word});
// print("{s}\n", .{line.items});
assert(line.items.len < 30);
}
} else {
@ -238,50 +230,39 @@ fn card(
}
const linesList = std.MultiArrayList(cardRow);
fn optionalAccess(slice: anytype, index: usize) []const u8 {
if(slice.len > index) return slice[index];
return "";
}
const cardRow = struct {
first: []const u8 = spacer,
second: []const u8 = spacer,
third: []const u8 = spacer,
last: []const u8 = "\n",
fn print(allocator: std.mem.Allocator, cards: []TextCard, allPrinted: *std.ArrayList([]const u8)) !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var lines = std.ArrayList([]const u8).init(allocator);
var lines = linesList{};
defer lines.deinit(gpa.allocator());
const dwd = try DisplayWidth.DisplayWidthData.init(allocator);
const dw = DisplayWidth{ .data = &dwd };
const endIndex = if(cards.len > 1) std.mem.max(u64, &.{
cards[0].lines.len,
cards[1].lines.len,
cards[2].lines.len
}) else cards[0].lines.len - 1;
for (cards, 0..) |cardObj, cardNo| {
const cardText = cardObj.lines;
for (cardText, 0..) |line, idx| {
const strippedLine = std.mem.trimRight(u8, line, " ");
const paddedLine = try std.fmt.allocPrint(gpa.allocator(), lineFormatter, .{strippedLine});
assert(dw.strWidth(paddedLine) == dw.strWidth(spacer));
const placeholder = if (idx < lines.items(.first).len) lines.get(idx) else cardRow{};
const new: cardRow = switch (cardNo) {
0 => .{ .first = paddedLine },
1 => .{ .first = placeholder.first, .second = paddedLine },
2 => .{ .first = placeholder.first, .second = placeholder.second, .third = paddedLine },
else => unreachable,
};
if (idx < lines.items(.first).len) {
lines.set(idx, new);
} else {
try lines.append(gpa.allocator(), new);
}
}
for(0..endIndex) |idx| {
try lines.append(
if(cards.len > 1)
try std.fmt.allocPrint(allocator, lineFormatter ** 3 ++ "\n", .{
optionalAccess(cards[0].lines, idx),
optionalAccess(cards[1].lines, idx),
optionalAccess(cards[2].lines, idx)
})
else cards[0].lines[idx]);
}
const rowHeight = lines.items(.first).len;
const rowHeight = lines.items.len;
while (pageHeight - (allPrinted.items.len % pageHeight) <= rowHeight) {
assert(rowHeight <= pageHeight);
try allPrinted.append(fullWidthSpacer);
}
for (lines.items(.first), 0..) |_, idx| {
const line = lines.get(idx);
const fullLine = try std.mem.concat(gpa.allocator(), u8, &[_][]const u8{ line.first, line.second, line.third, line.last });
assert(dw.strWidth(fullLine) == dw.strWidth(fullWidthSpacer));
try allPrinted.append(fullLine);
for (lines.items) |line| {
try allPrinted.append(line);
}
}
};