diff --git a/doc/Card.html b/doc/Card.html new file mode 100644 index 0000000..5ef4a41 --- /dev/null +++ b/doc/Card.html @@ -0,0 +1,271 @@ + + + + + + + +class Card - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

+ class Card +

+ +
+ +

Représente une carte à jouer avec sa valeur et sa couleur.

+ +
+ + +
+ diff --git a/doc/Deck.html b/doc/Deck.html new file mode 100644 index 0000000..b9f0947 --- /dev/null +++ b/doc/Deck.html @@ -0,0 +1,253 @@ + + + + + + + +class Deck - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

+ class Deck +

+ +
+ +

Représente un paquet de cartes et gère son contenu.

+ +
+ + +
+ diff --git a/doc/Game.html b/doc/Game.html new file mode 100644 index 0000000..323510d --- /dev/null +++ b/doc/Game.html @@ -0,0 +1,601 @@ + + + + + + + +class Game - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

+ class Game +

+ +
+ +

Gère le déroulement et les règles d’une partie d’Écarté.

+ +
+ + +
+ diff --git a/doc/Player.html b/doc/Player.html new file mode 100644 index 0000000..faf8cc0 --- /dev/null +++ b/doc/Player.html @@ -0,0 +1,331 @@ + + + + + + + +class Player - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

+ class Player +

+ +
+ +

Représente un joueur, sa main et son score.

+ +
+ + +
+ diff --git a/doc/README_md.html b/doc/README_md.html new file mode 100644 index 0000000..b43481d --- /dev/null +++ b/doc/README_md.html @@ -0,0 +1,90 @@ + + + + + + + +README - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + +
+ +

Écarté ↑

+ +
+ diff --git a/doc/TerminalUI.html b/doc/TerminalUI.html new file mode 100644 index 0000000..74dd4b0 --- /dev/null +++ b/doc/TerminalUI.html @@ -0,0 +1,270 @@ + + + + + + + +class TerminalUI - RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

+ class TerminalUI +

+ +
+ +

Gère l’affichage et les saisies dans le terminal.

+ +
+ + +
+ diff --git a/doc/created.rid b/doc/created.rid new file mode 100644 index 0000000..45c7f11 --- /dev/null +++ b/doc/created.rid @@ -0,0 +1,8 @@ +Thu, 08 Oct 2026 19:38:51 +0200 +/home/julien/src/ecarte/README.md Tue, 06 Oct 2026 15:31:12 +0200 +/home/julien/src/ecarte/lib/card.rb Thu, 08 Oct 2026 19:34:18 +0200 +/home/julien/src/ecarte/lib/deck.rb Thu, 08 Oct 2026 19:33:38 +0200 +/home/julien/src/ecarte/lib/game.rb Thu, 08 Oct 2026 19:33:06 +0200 +/home/julien/src/ecarte/lib/player.rb Thu, 08 Oct 2026 19:32:32 +0200 +/home/julien/src/ecarte/lib/terminal_ui.rb Thu, 08 Oct 2026 19:37:44 +0200 +/home/julien/src/ecarte/main.rb Thu, 08 Oct 2026 18:35:18 +0200 diff --git a/doc/css/fonts.css b/doc/css/fonts.css new file mode 100644 index 0000000..57302b5 --- /dev/null +++ b/doc/css/fonts.css @@ -0,0 +1,167 @@ +/* + * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), + * with Reserved Font Name "Source". All Rights Reserved. Source is a + * trademark of Adobe Systems Incorporated in the United States and/or other + * countries. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 400; + src: local("Source Code Pro"), + local("SourceCodePro-Regular"), + url("../fonts/SourceCodePro-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Source Code Pro"; + font-style: normal; + font-weight: 700; + src: local("Source Code Pro Bold"), + local("SourceCodePro-Bold"), + url("../fonts/SourceCodePro-Bold.ttf") format("truetype"); +} + +/* + * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com), + * with Reserved Font Name Lato. + * + * This Font Software is licensed under the SIL Open Font License, Version + * 1.1. + * + * This license is copied below, and is also available with a FAQ at: + * http://scripts.sil.org/OFL + */ + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 300; + src: local("Lato Light"), + local("Lato-Light"), + url("../fonts/Lato-Light.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 300; + src: local("Lato Light Italic"), + local("Lato-LightItalic"), + url("../fonts/Lato-LightItalic.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: normal; + font-weight: 700; + src: local("Lato Regular"), + local("Lato-Regular"), + url("../fonts/Lato-Regular.ttf") format("truetype"); +} + +@font-face { + font-family: "Lato"; + font-style: italic; + font-weight: 700; + src: local("Lato Italic"), + local("Lato-Italic"), + url("../fonts/Lato-RegularItalic.ttf") format("truetype"); +} + +/* + * ----------------------------------------------------------- + * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + * ----------------------------------------------------------- + * + * PREAMBLE + * The goals of the Open Font License (OFL) are to stimulate worldwide + * development of collaborative font projects, to support the font creation + * efforts of academic and linguistic communities, and to provide a free and + * open framework in which fonts may be shared and improved in partnership + * with others. + * + * The OFL allows the licensed fonts to be used, studied, modified and + * redistributed freely as long as they are not sold by themselves. The + * fonts, including any derivative works, can be bundled, embedded, + * redistributed and/or sold with any software provided that any reserved + * names are not used by derivative works. The fonts and derivatives, + * however, cannot be released under any other type of license. The + * requirement for fonts to remain under this license does not apply + * to any document created using the fonts or their derivatives. + * + * DEFINITIONS + * "Font Software" refers to the set of files released by the Copyright + * Holder(s) under this license and clearly marked as such. This may + * include source files, build scripts and documentation. + * + * "Reserved Font Name" refers to any names specified as such after the + * copyright statement(s). + * + * "Original Version" refers to the collection of Font Software components as + * distributed by the Copyright Holder(s). + * + * "Modified Version" refers to any derivative made by adding to, deleting, + * or substituting -- in part or in whole -- any of the components of the + * Original Version, by changing formats or by porting the Font Software to a + * new environment. + * + * "Author" refers to any designer, engineer, programmer, technical + * writer or other person who contributed to the Font Software. + * + * PERMISSION & CONDITIONS + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of the Font Software, to use, study, copy, merge, embed, modify, + * redistribute, and sell modified and unmodified copies of the Font + * Software, subject to the following conditions: + * + * 1) Neither the Font Software nor any of its individual components, + * in Original or Modified Versions, may be sold by itself. + * + * 2) Original or Modified Versions of the Font Software may be bundled, + * redistributed and/or sold with any software, provided that each copy + * contains the above copyright notice and this license. These can be + * included either as stand-alone text files, human-readable headers or + * in the appropriate machine-readable metadata fields within text or + * binary files as long as those fields can be easily viewed by the user. + * + * 3) No Modified Version of the Font Software may use the Reserved Font + * Name(s) unless explicit written permission is granted by the corresponding + * Copyright Holder. This restriction only applies to the primary font name as + * presented to the users. + * + * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + * Software shall not be used to promote, endorse or advertise any + * Modified Version, except to acknowledge the contribution(s) of the + * Copyright Holder(s) and the Author(s) or with their explicit written + * permission. + * + * 5) The Font Software, modified or unmodified, in part or in whole, + * must be distributed entirely under this license, and must not be + * distributed under any other license. The requirement for fonts to + * remain under this license does not apply to any document created + * using the Font Software. + * + * TERMINATION + * This license becomes null and void if any of the above conditions are + * not met. + * + * DISCLAIMER + * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM + * OTHER DEALINGS IN THE FONT SOFTWARE. + */ + diff --git a/doc/css/rdoc.css b/doc/css/rdoc.css new file mode 100644 index 0000000..c84a604 --- /dev/null +++ b/doc/css/rdoc.css @@ -0,0 +1,683 @@ +/* + * "Darkfish" RDoc CSS + * $Id: rdoc.css 54 2009-01-27 01:09:48Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* vim: ft=css et sw=2 ts=2 sts=2 */ + +/* 1. Variables and Root Styles */ +:root { + --sidebar-width: 300px; + --highlight-color: #cc342d; /* Reddish color for accents and headings */ + --secondary-highlight-color: #c83045; /* Darker reddish color for secondary highlights */ + --text-color: #505050; /* Dark bluish-grey for text */ + --background-color: #fefefe; /* Near white background */ + --code-block-background-color: #f6f6f3; /* Slightly darker grey for code blocks */ + --link-color: #42405F; /* Dark bluish-grey for links */ + --link-hover-color: var(--highlight-color); /* Reddish color on hover */ + --border-color: #e0e0e0;; /* General border color */ + --source-code-toggle-color: var(--secondary-highlight-color); + --scrollbar-thumb-hover-background: #505050; /* Hover color for scrollbar thumb */ + --table-header-background-color: #eceaed; + --table-td-background-color: #f5f4f6; + + /* Font family variables */ + --font-primary: 'Segoe UI', 'Verdana', 'Arial', sans-serif; + --font-heading: 'Helvetica', 'Arial', sans-serif; + --font-code: monospace; +} + +/* 2. Global Styles */ +body { + background: var(--background-color); + font-family: var(--font-primary); + font-weight: 400; + color: var(--text-color); + line-height: 1.6; + + /* Layout */ + display: flex; + flex-direction: column; + min-height: 100vh; + margin: 0; +} + +/* 3. Typography */ +h1 span, +h2 span, +h3 span, +h4 span, +h5 span, +h6 span { + position: relative; + + display: none; + padding-left: 1em; + line-height: 0; + vertical-align: baseline; + font-size: 10px; +} + +h1 span { top: -1.3em; } +h2 span { top: -1.2em; } +h3 span { top: -1.0em; } +h4 span { top: -0.8em; } +h5 span { top: -0.5em; } +h6 span { top: -0.5em; } + +h1:hover span, +h2:hover span, +h3:hover span, +h4:hover span, +h5:hover span, +h6:hover span { + display: inline; +} + +h1:target, +h2:target, +h3:target, +h4:target, +h5:target, +h6:target { + margin-left: -10px; + border-left: 10px solid var(--border-color); + scroll-margin-top: 1rem; +} + +main .anchor-link:target { + scroll-margin-top: 1rem; +} + +/* 4. Links */ +a { + color: var(--link-color); + transition: color 0.3s ease; + text-decoration: underline; + text-underline-offset: 0.2em; /* Make sure it doesn't overlap with underscores in a method name. */ +} + +a:hover { + color: var(--link-hover-color); +} + +a code:hover { + color: var(--link-hover-color); +} + +/* 5. Code and Pre */ +code, +pre { + font-family: var(--font-code); + background-color: var(--code-block-background-color); + border: 1px solid var(--border-color); + border-radius: 6px; + padding: 16px; + overflow-x: auto; + font-size: 15px; + line-height: 1.5; + margin: 1em 0; +} + +code { + background-color: var(--code-block-background-color); + padding: 0.1em 0.3em; + border-radius: 3px; + font-size: 85%; +} + +/* Tables */ +table { + margin: 0; + border-spacing: 0; + border-collapse: collapse; +} + +table tr th, table tr td { + padding: 0.2em 0.4em; + border: 1px solid var(--border-color); +} + +table tr th { + background-color: var(--table-header-background-color); +} + +table tr:nth-child(even) td { + background-color: var(--table-td-background-color); +} + +/* 7. Navigation and Sidebar */ +nav { + font-family: var(--font-heading); + font-size: 16px; + border-right: 1px solid var(--border-color); + position: fixed; + top: 0; + bottom: 0; + left: 0; + width: var(--sidebar-width); + background: var(--background-color); /* It needs an explicit background for toggling narrow screens */ + overflow-y: auto; + z-index: 10; + display: flex; + flex-direction: column; + color: var(--text-color); +} + +nav[hidden] { + display: none; +} + +nav footer { + padding: 1em; + border-top: 1px solid var(--border-color); +} + +nav footer a { + color: var(--secondary-highlight-color); +} + +nav .nav-section { + margin-top: 1em; + padding: 0 1em; +} + +nav h2, nav h3 { + margin: 0 0 0.5em; + padding: 0.5em 0; + color: var(--highlight-color); + border-bottom: 1px solid var(--border-color); +} + +nav h2 { + font-size: 1.2em; +} + +nav h3, +#table-of-contents-navigation { + font-size: 1em; +} + +ol.breadcrumb { + display: flex; + + padding: 0; + margin: 0 0 1em; +} + +ol.breadcrumb li { + display: block; + list-style: none; + font-size: 125%; +} + +nav ul, +nav dl, +nav p { + padding: 0; + list-style: none; + margin: 0.5em 0; +} + +nav ul li { + margin-bottom: 0.3em; +} + +nav ul ul { + padding-left: 1em; +} + +nav ul ul ul { + padding-left: 1em; +} + +nav ul ul ul ul { + padding-left: 1em; +} + +nav a { + color: var(--link-color); + text-decoration: none; +} + +nav a:hover { + color: var(--link-hover-color); + text-decoration: underline; +} + +#navigation-toggle { + z-index: 1000; + font-size: 2em; + display: block; + position: fixed; + top: 10px; + left: 20px; + cursor: pointer; +} + +#navigation-toggle[aria-expanded="true"] { + top: 10px; + left: 250px; +} + +nav ul li details { + position: relative; + padding-right: 1.5em; /* Add space for the marker on the right */ +} + +nav ul li details > summary { + list-style: none; /* Remove the default marker */ + position: relative; /* So that the open/close triangle can position itself absolutely inside */ +} + +nav ul li details > summary::-webkit-details-marker { + display: none; /* Removes the default marker, in Safari 18. */ +} + +nav ul li details > summary::after { + content: '▶'; /* Unicode right-pointing triangle */ + position: absolute; + font-size: 0.8em; + bottom: 0.1em; + margin-left: 0.3em; + transition: transform 0.2s ease; +} + +nav ul li details[open] > summary::after { + transform: rotate(90deg); /* Rotate the triangle when open */ +} + +/* 8. Main Content */ +main { + flex: 1; + display: block; + margin: 3em auto; + padding: 0 2em; + max-width: 800px; + font-size: 16px; + line-height: 1.6; + color: var(--text-color); + box-sizing: border-box; +} + +@media (min-width: 1024px) { + main { + margin-left: var(--sidebar-width); + } + + .table-of-contents main { + margin-left: 20em; + } + + #navigation-toggle { + display: none; + } +} + +main h1[class] { + margin-top: 0; + margin-bottom: 1em; + font-size: 2.5em; + color: var(--highlight-color); +} + +main h1, +main h2, +main h3, +main h4, +main h5, +main h6 { + font-family: var(--font-heading); + color: var(--highlight-color); +} + +/* Search */ +#search-section { + padding: 1em; + background-color: var(--background-color); + border-bottom: 1px solid var(--border-color); +} + +#search-field-wrapper { + position: relative; + display: flex; + align-items: center; +} + +#search-field { + width: 100%; + padding: 0.5em 1em 0.5em 2.5em; + border: 1px solid var(--border-color); + border-radius: 20px; + font-size: 14px; + outline: none; + transition: border-color 0.3s ease; + color: var(--text-color); +} + +#search-field:focus { + border-color: var(--highlight-color); +} + +#search-field::placeholder { + color: var(--text-color); +} + +#search-field-wrapper::before { + content: "\1F50D"; + position: absolute; + left: 0.75em; + top: 50%; + transform: translateY(-50%); + font-size: 14px; + color: var(--text-color); + opacity: 0.6; +} + +/* Search Results */ +#search-results { + font-family: var(--font-primary); + font-weight: 300; +} + +#search-results .search-match { + font-family: var(--font-heading); + font-weight: normal; +} + +#search-results .search-selected { + background: var(--code-block-background-color); + border-bottom: 1px solid transparent; +} + +#search-results li { + list-style: none; + border-bottom: 1px solid var(--border-color); + margin-bottom: 0.5em; +} + +#search-results li:last-child { + border-bottom: none; + margin-bottom: 0; +} + +#search-results li p { + padding: 0; + margin: 0.5em; +} + +#search-results .search-namespace { + font-weight: bold; +} + +#search-results li em { + background-color: rgba(224, 108, 117, 0.1); + font-style: normal; +} + +#search-results pre { + margin: 0.5em; + font-family: var(--font-code); +} + +/* Syntax Highlighting - Gruvbox Light Scheme */ + +.ruby-constant { color: #AF3A03; } /* Dark Orange */ +.ruby-keyword { color: #9D0006; } /* Dark Red */ +.ruby-ivar { color: #B57614; } /* Brown */ +.ruby-operator { color: #427B58; } /* Dark Teal */ +.ruby-identifier { color: #076678; } /* Deep Teal */ +.ruby-node { color: #8F3F71; } /* Plum */ +.ruby-comment { color: #928374; font-style: italic; } /* Gray */ +.ruby-regexp { color: #8F3F71; } /* Plum */ +.ruby-value { color: #AF3A03; } /* Dark Orange */ +.ruby-string { color: #79740E; } /* Olive */ + +/* Emphasis */ +em { + text-decoration-color: rgba(52, 48, 64, 0.25); + text-decoration-line: underline; + text-decoration-style: dotted; +} + +strong, +em { + color: var(--highlight-color); + background-color: rgba(255, 111, 97, 0.1); /* Light red background for emphasis */ +} + +/* Paragraphs */ +main p { + line-height: 1.5em; + font-weight: 400; +} + +/* Preformatted Text */ +main pre { + margin: 1.2em 0.5em; + padding: 1em; + font-size: 0.8em; +} + +/* Horizontal Rules */ +main hr { + margin: 1.5em 1em; + border: 2px solid var(--border-color); +} + +/* Blockquotes */ +main blockquote { + margin: 0 2em 1.2em 1.2em; + padding-left: 0.5em; + border-left: 2px solid var(--border-color); +} + +/* Lists */ +main li > p { + margin: 0.5em; +} + +/* Definition Lists */ +main dl { + margin: 1em 0.5em; +} + +main dt { + line-height: 1.5; /* matches `main p` */ + font-weight: bold; +} + +main dl.note-list dt { + margin-right: 1em; + float: left; +} + +main dl.note-list dt:has(+ dt) { + margin-right: 0.25em; +} + +main dl.note-list dt:has(+ dt)::after { + content: ', '; + font-weight: normal; +} + +main dd { + margin: 0 0 1em 1em; +} + +main dd p:first-child { + margin-top: 0; +} + +/* Headers within Main */ +main header h2 { + margin-top: 2em; + border-width: 0; + border-top: 4px solid var(--border-color); + font-size: 130%; +} + +main header h3 { + margin: 2em 0 1.5em; + border-width: 0; + border-top: 3px solid var(--border-color); + font-size: 120%; +} + +/* Utility Classes */ +.hide { display: none !important; } +.initially-hidden { display: none; } + +/* Table of Contents */ +.table-of-contents ul { + margin: 1em; + list-style: none; +} + +.table-of-contents ul ul { + margin-top: 0.25em; +} + +.table-of-contents ul :link, +.table-of-contents ul :visited { + font-size: 16px; +} + +.table-of-contents li { + margin-bottom: 0.25em; +} + +/* Method Details */ +main .method-source-code { + visibility: hidden; + max-height: 0; + overflow: auto; + transition-duration: 200ms; + transition-delay: 0ms; + transition-property: all; + transition-timing-function: ease-in-out; +} + +main .method-source-code pre { + border-color: var(--source-code-toggle-color); +} + +main .method-source-code.active-menu { + visibility: visible; + max-height: 100vh; +} + +main .method-description .method-calls-super { + color: var(--text-color); + font-weight: bold; +} + +main .method-detail { + margin-bottom: 2.5em; +} + +main .method-detail:target { + margin-left: -10px; + border-left: 10px solid var(--border-color); +} + +main .method-header { + display: inline-block; +} + +main .method-heading { + position: relative; + font-family: var(--font-code); + font-size: 110%; + font-weight: bold; +} + +main .method-heading::after { + content: '¶'; + position: absolute; + visibility: hidden; + color: var(--highlight-color); + font-size: 0.5em; +} + +main .method-heading:hover::after { + visibility: visible; +} + +main .method-controls { + line-height: 20px; + float: right; + color: var(--source-code-toggle-color); + cursor: pointer; +} + +main .method-description, +main .aliases { + margin-top: 0.75em; + color: var(--text-color); +} + +main .aliases { + padding-top: 4px; + font-style: italic; + cursor: default; +} + +main .aliases a { + color: var(--secondary-highlight-color); +} + +main .mixin-from { + font-size: 80%; + font-style: italic; + margin-bottom: 0.75em; +} + +main .method-description ul { + margin-left: 1.5em; +} + +main #attribute-method-details .method-detail:hover { + background-color: transparent; + cursor: default; +} + +main .attribute-access-type { + text-transform: uppercase; +} + +/* Responsive Adjustments */ +@media (max-width: 480px) { + nav { + width: 100%; + } + + main { + margin: 1em auto; + padding: 0 1em; + max-width: 100%; + } + + #navigation-toggle { + right: 10px; + left: auto; + } + + #navigation-toggle[aria-expanded="true"] { + left: auto; + } + + table { + display: block; + overflow-x: auto; + white-space: nowrap; + } + + main .method-controls { + margin-top: 10px; + float: none; + } +} diff --git a/doc/fonts/Lato-Light.ttf b/doc/fonts/Lato-Light.ttf new file mode 100644 index 0000000..b49dd43 Binary files /dev/null and b/doc/fonts/Lato-Light.ttf differ diff --git a/doc/fonts/Lato-LightItalic.ttf b/doc/fonts/Lato-LightItalic.ttf new file mode 100644 index 0000000..7959fef Binary files /dev/null and b/doc/fonts/Lato-LightItalic.ttf differ diff --git a/doc/fonts/Lato-Regular.ttf b/doc/fonts/Lato-Regular.ttf new file mode 100644 index 0000000..839cd58 Binary files /dev/null and b/doc/fonts/Lato-Regular.ttf differ diff --git a/doc/fonts/Lato-RegularItalic.ttf b/doc/fonts/Lato-RegularItalic.ttf new file mode 100644 index 0000000..bababa0 Binary files /dev/null and b/doc/fonts/Lato-RegularItalic.ttf differ diff --git a/doc/fonts/SourceCodePro-Bold.ttf b/doc/fonts/SourceCodePro-Bold.ttf new file mode 100644 index 0000000..dd00982 Binary files /dev/null and b/doc/fonts/SourceCodePro-Bold.ttf differ diff --git a/doc/fonts/SourceCodePro-Regular.ttf b/doc/fonts/SourceCodePro-Regular.ttf new file mode 100644 index 0000000..1decfb9 Binary files /dev/null and b/doc/fonts/SourceCodePro-Regular.ttf differ diff --git a/doc/images/add.png b/doc/images/add.png new file mode 100644 index 0000000..6332fef Binary files /dev/null and b/doc/images/add.png differ diff --git a/doc/images/arrow_up.png b/doc/images/arrow_up.png new file mode 100644 index 0000000..1ebb193 Binary files /dev/null and b/doc/images/arrow_up.png differ diff --git a/doc/images/brick.png b/doc/images/brick.png new file mode 100644 index 0000000..7851cf3 Binary files /dev/null and b/doc/images/brick.png differ diff --git a/doc/images/brick_link.png b/doc/images/brick_link.png new file mode 100644 index 0000000..9ebf013 Binary files /dev/null and b/doc/images/brick_link.png differ diff --git a/doc/images/bug.png b/doc/images/bug.png new file mode 100644 index 0000000..2d5fb90 Binary files /dev/null and b/doc/images/bug.png differ diff --git a/doc/images/bullet_black.png b/doc/images/bullet_black.png new file mode 100644 index 0000000..5761970 Binary files /dev/null and b/doc/images/bullet_black.png differ diff --git a/doc/images/bullet_toggle_minus.png b/doc/images/bullet_toggle_minus.png new file mode 100644 index 0000000..b47ce55 Binary files /dev/null and b/doc/images/bullet_toggle_minus.png differ diff --git a/doc/images/bullet_toggle_plus.png b/doc/images/bullet_toggle_plus.png new file mode 100644 index 0000000..9ab4a89 Binary files /dev/null and b/doc/images/bullet_toggle_plus.png differ diff --git a/doc/images/date.png b/doc/images/date.png new file mode 100644 index 0000000..783c833 Binary files /dev/null and b/doc/images/date.png differ diff --git a/doc/images/delete.png b/doc/images/delete.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/doc/images/delete.png differ diff --git a/doc/images/find.png b/doc/images/find.png new file mode 100644 index 0000000..1547479 Binary files /dev/null and b/doc/images/find.png differ diff --git a/doc/images/loadingAnimation.gif b/doc/images/loadingAnimation.gif new file mode 100644 index 0000000..82290f4 Binary files /dev/null and b/doc/images/loadingAnimation.gif differ diff --git a/doc/images/macFFBgHack.png b/doc/images/macFFBgHack.png new file mode 100644 index 0000000..c6473b3 Binary files /dev/null and b/doc/images/macFFBgHack.png differ diff --git a/doc/images/package.png b/doc/images/package.png new file mode 100644 index 0000000..da3c2a2 Binary files /dev/null and b/doc/images/package.png differ diff --git a/doc/images/page_green.png b/doc/images/page_green.png new file mode 100644 index 0000000..de8e003 Binary files /dev/null and b/doc/images/page_green.png differ diff --git a/doc/images/page_white_text.png b/doc/images/page_white_text.png new file mode 100644 index 0000000..813f712 Binary files /dev/null and b/doc/images/page_white_text.png differ diff --git a/doc/images/page_white_width.png b/doc/images/page_white_width.png new file mode 100644 index 0000000..1eb8809 Binary files /dev/null and b/doc/images/page_white_width.png differ diff --git a/doc/images/plugin.png b/doc/images/plugin.png new file mode 100644 index 0000000..6187b15 Binary files /dev/null and b/doc/images/plugin.png differ diff --git a/doc/images/ruby.png b/doc/images/ruby.png new file mode 100644 index 0000000..f763a16 Binary files /dev/null and b/doc/images/ruby.png differ diff --git a/doc/images/tag_blue.png b/doc/images/tag_blue.png new file mode 100644 index 0000000..3f02b5f Binary files /dev/null and b/doc/images/tag_blue.png differ diff --git a/doc/images/tag_green.png b/doc/images/tag_green.png new file mode 100644 index 0000000..83ec984 Binary files /dev/null and b/doc/images/tag_green.png differ diff --git a/doc/images/transparent.png b/doc/images/transparent.png new file mode 100644 index 0000000..d665e17 Binary files /dev/null and b/doc/images/transparent.png differ diff --git a/doc/images/wrench.png b/doc/images/wrench.png new file mode 100644 index 0000000..5c8213f Binary files /dev/null and b/doc/images/wrench.png differ diff --git a/doc/images/wrench_orange.png b/doc/images/wrench_orange.png new file mode 100644 index 0000000..565a933 Binary files /dev/null and b/doc/images/wrench_orange.png differ diff --git a/doc/images/zoom.png b/doc/images/zoom.png new file mode 100644 index 0000000..908612e Binary files /dev/null and b/doc/images/zoom.png differ diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..731505e --- /dev/null +++ b/doc/index.html @@ -0,0 +1,95 @@ + + + + + + + +RDoc Documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+

This is the API documentation for RDoc Documentation. +

+ diff --git a/doc/js/darkfish.js b/doc/js/darkfish.js new file mode 100644 index 0000000..4c15efd --- /dev/null +++ b/doc/js/darkfish.js @@ -0,0 +1,120 @@ +/** + * + * Darkfish Page Functions + * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $ + * + * Author: Michael Granger + * + */ + +/* Provide console simulation for firebug-less environments */ +/* +if (!("console" in window) || !("firebug" in console)) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", + "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; + + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +}; +*/ + + +function showSource( e ) { + var target = e.target; + while (!target.classList.contains('method-detail')) { + target = target.parentNode; + } + if (typeof target !== "undefined" && target !== null) { + target = target.querySelector('.method-source-code'); + } + if (typeof target !== "undefined" && target !== null) { + target.classList.toggle('active-menu') + } +}; + +function hookSourceViews() { + document.querySelectorAll('.method-source-toggle').forEach(function (codeObject) { + codeObject.addEventListener('click', showSource); + }); +}; + +function hookSearch() { + var input = document.querySelector('#search-field'); + var result = document.querySelector('#search-results'); + result.classList.remove("initially-hidden"); + + var search_section = document.querySelector('#search-section'); + search_section.classList.remove("initially-hidden"); + + var search = new Search(search_data, input, result); + + search.renderItem = function(result) { + var li = document.createElement('li'); + var html = ''; + + // TODO add relative path to + + + + + + + + + + + + + + + + +
+

Table of Contents - RDoc Documentation

+ +

Pages

+ + +

Classes and Modules

+ + +

Methods

+ +
+ diff --git a/lib/card.rb b/lib/card.rb index 0f2fd16..4049fe2 100644 --- a/lib/card.rb +++ b/lib/card.rb @@ -1,3 +1,4 @@ +# Représente une carte à jouer avec sa valeur et sa couleur. class Card attr_reader :value, :suit @@ -6,10 +7,12 @@ class Card @suit = suit end + # Retourne une représentation de la carte sous forme de string. def to_s "#{@value} of #{@suit}" end + # Retourne la force de la carte sous forme d'integer. def strength if @value.match?(/\A\d+\z/) @value.to_i diff --git a/lib/deck.rb b/lib/deck.rb index 4c0fa36..dbbffde 100644 --- a/lib/deck.rb +++ b/lib/deck.rb @@ -1,5 +1,6 @@ require_relative "card" +# Représente un paquet de cartes et gère son contenu. class Deck attr_reader :cards @@ -15,10 +16,12 @@ class Deck end end + # Mélange les cartes du paquet. def shuffle @cards.shuffle! end + # Retire et retourne la dernière carte du paquet. def draw @cards.pop end diff --git a/lib/game.rb b/lib/game.rb index bb98fee..556372b 100644 --- a/lib/game.rb +++ b/lib/game.rb @@ -2,6 +2,7 @@ require_relative "deck" require_relative "player" require_relative "terminal_ui" +# Gère le déroulement et les règles d'une partie d'Écarté. class Game attr_reader :player1, :player2, :dealer, :non_dealer, :upcard, :trump_suit, :trick_winner @@ -18,6 +19,7 @@ class Game @ui = TerminalUI.new end + # Simule une coupe pour déterminer quel joueur sera le donneur. def determine_dealer @deck.shuffle @@ -35,12 +37,14 @@ class Game end end + # Échange les rôles de donneur et de non-donneur. def change_dealer old_dealer = @dealer @dealer = @non_dealer @non_dealer = old_dealer end + # Distribue les cartes et pose la retourne. def deal @player1.clear_hand @player2.clear_hand @@ -56,10 +60,12 @@ class Game @trump_suit = @upcard.suit end + # Retourne les cartes restantes dans le talon. def stock @deck.cards end + # Vérifie si le coup du second joueur respecte les règles. def valid_follow_card?(follow_player, lead_card, follow_card) if follow_card.suit == lead_card.suit true @@ -70,6 +76,7 @@ class Game end end + # Joue un pli. def play_trick(lead_player, follow_player) lead_card = @ui.choose_card(lead_player) follow_card = @ui.choose_card(follow_player) @@ -94,10 +101,12 @@ class Game @ui.display_trick_winner(@trick_winner) end + # Retourne l'autre joueur. def other_player(player) player == @player1 ? @player2 : @player1 end + # Joue une partie. def play lead_player = @non_dealer follow_player = @dealer @@ -105,11 +114,12 @@ class Game 5.times do play_trick(lead_player, follow_player) - lead_player = @trick_winner - follow_player = other_player(lead_player) + lead_player = @trick_winner + follow_player = other_player(lead_player) end end + # Retourne le joueur ayant le meilleur score. def game_winner if @player1.score > @player2.score @player1 diff --git a/lib/player.rb b/lib/player.rb index 2bc4968..e52ea4c 100644 --- a/lib/player.rb +++ b/lib/player.rb @@ -1,3 +1,4 @@ +# Représente un joueur, sa main et son score. class Player attr_reader :name, :hand, :score @@ -7,18 +8,22 @@ class Player @score = 0 end + # Ajoute une carte à la main du joueur. def receive(card) @hand << card end + # Vide la main du joueur. def clear_hand @hand.clear end + # Retire une carte de la main du joueur. def play(card) @hand.delete(card) end + # Ajoute un point au joueur. def add_point @score += 1 end diff --git a/lib/terminal_ui.rb b/lib/terminal_ui.rb index 3cdb4b6..13e1af3 100644 --- a/lib/terminal_ui.rb +++ b/lib/terminal_ui.rb @@ -1,4 +1,7 @@ +# Gère l'affichage et les saisies dans le terminal. class TerminalUI + + # Demande au joueur de choisir une carte et la retourne. def choose_card(player) player.hand.each_with_index do |card, index| puts "#{index + 1}. #{card}" @@ -10,15 +13,18 @@ class TerminalUI player.hand[choice - 1] end + # Affiche un avertissement si le coup joué ne respecte pas les règles. def display_wrong_card puts "You cannot play this card." end + # Affiche le joueur ayant remporté le pli. def display_trick_winner(player) puts "#{player.name} wins the trick." puts end + # Affiche les informations de débogage. def debug_game(game) puts "Dealer: #{game.dealer.name}" puts "Non-dealer: #{game.non_dealer.name}" diff --git a/main.rb b/main.rb index 4714ee7..2f1afcb 100644 --- a/main.rb +++ b/main.rb @@ -1,24 +1,10 @@ #!/usr/bin/env ruby require_relative "lib/game" -require_relative "lib/terminal_ui" -# Instance du jeu +# Crée une partie. game = Game.new("Alice", "Bob") -ui = TerminalUI.new game.determine_dealer game.deal - -# Première manche -ui.debug_game(game) game.play - -# Nouvelle manche -# game.change_dealer -# game.deal -# ui.debug_game(game) - -# card = ui.choose_card(game.player1) -# puts "#{game.player1.name} chose #{card}." -