From d113cea2117ffa62fb7e2518b9417e51c852cdb0 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 16 Jun 2023 05:34:27 +0300 Subject: [PATCH] add more examples from original repo --- examples/japan-grid.d2 | 167 +++++++++++++++++++++++++++++++++++++ examples/wcc.d2 | 183 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 350 insertions(+) create mode 100644 examples/japan-grid.d2 create mode 100644 examples/wcc.d2 diff --git a/examples/japan-grid.d2 b/examples/japan-grid.d2 new file mode 100644 index 0000000..06973ea --- /dev/null +++ b/examples/japan-grid.d2 @@ -0,0 +1,167 @@ +classes: { + NONE: {style.opacity: 0} + GREEN: {style.stroke: "#2b9464"; style.fill: "#2b9464"} + RED: {style.stroke: "#d14d28"; style.fill: "#d14d28"} + YELLOW: {style.stroke: "#f5df65"; style.fill: "#f5df65"} + BLUE: {style.stroke: "#59c8df"; style.fill: "#59c8df"} +} + +grid-rows: 12 +grid-columns: 12 +grid-gap: 0 + +12-1: "" {class: NONE} +12-2: "" {class: NONE} +12-3: "" {class: NONE} +12-4: "" {class: NONE} +12-5: "" {class: NONE} +12-6: "" {class: NONE} +12-7: "" {class: NONE} +12-8: "" {class: NONE} +12-9: "" {class: NONE} +12-10: "" {class: NONE} +12-11: "" {class: GREEN} +12-12: "北海道" {class: GREEN} + +11-1: "" {class: NONE} +11-2: "" {class: NONE} +11-3: "" {class: NONE} +11-4: "" {class: NONE} +11-5: "" {class: NONE} +11-6: "" {class: NONE} +11-7: "" {class: NONE} +11-8: "" {class: NONE} +11-9: "" {class: NONE} +11-10: "" {class: NONE} +11-11: "" {class: GREEN} +11-12: "" {class: GREEN} + +10-1: "" {class: NONE} +10-2: "" {class: NONE} +10-3: "" {class: NONE} +10-4: "" {class: NONE} +10-5: "" {class: NONE} +10-6: "" {class: NONE} +10-7: "" {class: NONE} +10-8: "" {class: NONE} +10-9: "" {class: NONE} +10-10: "" {class: NONE} +10-11: "青森" {class: RED} +10-12: "" {class: NONE} + +9-1: "" {class: NONE} +9-2: "" {class: NONE} +9-3: "" {class: NONE} +9-4: "" {class: NONE} +9-5: "" {class: NONE} +9-6: "" {class: NONE} +9-7: "" {class: NONE} +9-8: "" {class: NONE} +9-9: "" {class: NONE} +9-10: "" {class: NONE} +9-11: "秋田" {class: YELLOW} +9-12: "岩手" {class: GREEN} + +8-1: "" {class: NONE} +8-2: "" {class: NONE} +8-3: "" {class: NONE} +8-4: "" {class: NONE} +8-5: "" {class: NONE} +8-6: "" {class: NONE} +8-7: "" {class: NONE} +8-8: "石川" {class: GREEN} +8-9: "" {class: NONE} +8-10: "新潟" {class: BLUE} +8-11: "山形" {class: RED} +8-12: "宮城" {class: BLUE} + +7-1: "" {class: NONE} +7-2: "" {class: NONE} +7-3: "" {class: NONE} +7-4: "" {class: NONE} +7-5: "" {class: NONE} +7-6: "" {class: NONE} +7-7: "" {class: NONE} +7-8: "福井" {class: RED} +7-9: "富山" {class: YELLOW} +7-10: "群馬" {class: GREEN} +7-11: "栃木" {class: YELLOW} +7-12: "福島" {class: GREEN} + +6-1: "" {class: NONE} +6-2: "" {class: NONE} +6-3: "山口" {class: RED} +6-4: "島根" {class: YELLOW} +6-5: "鳥取" {class: RED} +6-6: "兵庫" {class: BLUE} +6-7: "京都" {class: YELLOW} +6-8: "滋賀" {class: GREEN} +6-9: "長野" {class: RED} +6-10: "山梨" {class: YELLOW} +6-11: "埼玉" {class: BLUE} +6-12: "茨城" {class: RED} + +5-1: "" {class: NONE} +5-2: "" {class: NONE} +5-3: "" {class: NONE} +5-4: "広島" {class: BLUE} +5-5: "岡山" {class: YELLOW} +5-6: "大阪" {class: GREEN} +5-7: "奈良" {class: RED} +5-8: "岐阜" {class: BLUE} +5-9: "愛知" {class: YELLOW} +5-10: "静岡" {class: BLUE} +5-11: "TOKYO" {class: GREEN} +5-12: "千葉" {class: YELLOW} + +4-1: "長崎" {class: BLUE} +4-2: "佐賀" {class: RED} +4-3: "福岡" {class: GREEN} +4-4: "" {class: NONE} +4-5: "" {class: NONE} +4-6: "" {class: NONE} +4-7: "和歌山" {class: GREEN} +4-8: "三重" {class: RED} +4-9: "" {class: NONE} +4-10: "" {class: NONE} +4-11: "神奈川" {class: RED} +4-12: "" {class: NONE} + +3-1: "" {class: NONE} +3-2: "熊本" {class: YELLOW} +3-3: "大分" {class: BLUE} +3-4: "" {class: NONE} +3-5: "愛媛" {class: RED} +3-6: "香川" {class: BLUE} +3-7: "" {class: NONE} +3-8: "" {class: NONE} +3-9: "" {class: NONE} +3-10: "" {class: NONE} +3-11: "" {class: NONE} +3-12: "" {class: NONE} + +2-1: "" {class: NONE} +2-2: "鹿児島" {class: RED} +2-3: "宮崎" {class: GREEN} +2-4: "" {class: NONE} +2-5: "高知" {class: GREEN} +2-6: "徳島" {class: YELLOW} +2-7: "" {class: NONE} +2-8: "" {class: NONE} +2-9: "" {class: NONE} +2-10: "" {class: NONE} +2-11: "" {class: NONE} +2-12: "" {class: NONE} + +1-1: "沖縄" {class: BLUE} +1-2: "" {class: NONE} +1-3: "" {class: NONE} +1-4: "" {class: NONE} +1-5: "" {class: NONE} +1-6: "" {class: NONE} +1-7: "" {class: NONE} +1-8: "" {class: NONE} +1-9: "" {class: NONE} +1-10: "" {class: NONE} +1-11: "" {class: NONE} +1-12: "" {class: NONE} diff --git a/examples/wcc.d2 b/examples/wcc.d2 new file mode 100644 index 0000000..bd9dcdf --- /dev/null +++ b/examples/wcc.d2 @@ -0,0 +1,183 @@ +How to become the World Chess Champion: { + near: top-center + shape: text + style.font-size: 55 +} + +gm: Become a Grandmaster (GM) { + link: layers.gm +} +qualify: Qualify for the Candidates Tournament { + link: layers.qualify +} +win: Win the Candidates Tournament { + link: layers.win +} +match: Defeat the former Champion { + link: layers.match +} + +gm -> qualify -> win -> match + +layers: { + gm: { + description: |md + # Become a Grandmaster (GM) + A Grandmaster is the highest title awarded by FIDE (the International Chess Federation). + | { + near: top-center + } + play: Play in FIDE-rated tournaments + ➡️: { + shape: text + near: center-right + link: steps.1 + style.font-size: 24 + } + steps: { + 1: { + titled: Earn pre-requisite titles (IM) + play -> titled + ➡️.link: _.steps.2 + } + 2: { + ➡️.link: _._ + rating: Achieve 2500 rating + norms: Earn 3 GM norms\n(defeat other GMs in tournaments) + titled -> rating + titled -> norms + } + } + } + qualify: { + description: |md + # Qualify for the Candidates Tournament + The Candidates tournament is played among the best players in the world to determine the challenger for the next world chess championship. + | { + near: top-center + } + One of: { + Runner-up to last championship + Finish top 2 in FIDE Grand Prix + Top 2 highest rated + Organizer wild card + Occasional other FIDE events: { + This varies year to year + } + } + } + win: { + description: |md + # Winning the Candidates tournament + + 8-players face off in a double round-robin. + + Which mean each player plays every other player, one with white and once with black. + | { + near: top-center + } + + 2022 Players: { + grid-rows: 9 + grid-columns: 3 + grid-gap: 0 + + Player + Rating + World ranking + + Ian Nepomniachtchi + 2766 + 7 + + Teimour Radjabov + 2753 + 13 + + Jan-Krzysztof Duda + 2750 + 16 + + Alireza Firouzja + 2793 + 3 + + Fabiano Caruana + 2783 + 4 + + Hikaru Nakamura + 2760 + 11 + + Richard Rapport + 2764 + 8 + + Ding Liren + 2806 + 2 + } + } + match: { + description: |md + # World Chess Championship Match + A 14-game 1v1 between the challenger and the current world champion[0]. + + [0] Usually. In 2023, Magnus Carlsen declined to participate. + + Instead, the runner-up of the Candidates tournament plays. + | { + near: top-center + } + + ding: Ding Liren { + icon: https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/World_Chess_Championship_2023%2C_game_01%2C_Ding_Liren.jpg/220px-World_Chess_Championship_2023%2C_game_01%2C_Ding_Liren.jpg + shape: image + near: center-left + height: 300 + width: 200 + } + + nepo: Ian Nepomniachtchi { + icon: https://upload.wikimedia.org/wikipedia/commons/thumb/6/67/World_Chess_Championship_2021%2C_game_07%2C_Ian_Nepomniachtchi_%28cropped%29.jpg/220px-World_Chess_Championship_2021%2C_game_07%2C_Ian_Nepomniachtchi_%28cropped%29.jpg + shape: image + near: center-right + height: 300 + width: 200 + } + + best of 14 games -> tiebreaks: if needed + tiebreaks.link: layers.tiebreaks + + layers: { + tiebreaks: { + description: |md + # Tiebreaks + + Use faster time controls to induce errors. + | { + near: top-center + } + + rapid: 4 rapid games { + 25 mins per side + 10-second increment + } + + blitz: 2 blitz games { + 5 mins per side + 3-second increment + } + + sudden death: { + 3 mins per side + 2-second increment + repeat until a win + } + + rapid -> blitz -> sudden death: if needed + } + } + } +}