This commit is contained in:
Sarsoo 2021-07-10 22:56:15 +00:00
parent 55a29fbd6f
commit b3661c9a5b
28 changed files with 346 additions and 116 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -3,5 +3,5 @@
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../draught/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate draught</p><div class="block version"><p>Version 0.1.0</p></div><a id="all-types" href="index.html"><p>Back to index</p></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">List of all items</span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span>
</span>
</h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="board/struct.Board.html">board::Board</a></li><li><a href="board/struct.BrdIdx.html">board::BrdIdx</a></li><li><a href="board/struct.Direction.html">board::Direction</a></li><li><a href="board/struct.Piece.html">board::Piece</a></li><li><a href="board/struct.Square.html">board::Square</a></li><li><a href="board/iter/struct.PieceIterator.html">board::iter::PieceIterator</a></li><li><a href="board/iter/struct.RowIndexIterator.html">board::iter::RowIndexIterator</a></li><li><a href="board/iter/struct.RowSquareIterator.html">board::iter::RowSquareIterator</a></li><li><a href="comp/struct.Computer.html">comp::Computer</a></li><li><a href="comp/struct.Move.html">comp::Move</a></li><li><a href="game/struct.Game.html">game::Game</a></li><li><a href="paint/struct.Painter.html">paint::Painter</a></li><li><a href="player/struct.Player.html">player::Player</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="board/enums/enum.MoveType.html">board::enums::MoveType</a></li><li><a href="board/enums/enum.Moveable.html">board::enums::Moveable</a></li><li><a href="board/enums/enum.SquareState.html">board::enums::SquareState</a></li><li><a href="board/enums/enum.Strength.html">board::enums::Strength</a></li><li><a href="board/enums/enum.Team.html">board::enums::Team</a></li></ul><h3 id="Macros">Macros</h3><ul class="macros docblock"><li><a href="macro.log.html">log</a></li></ul><h3 id="Functions">Functions</h3><ul class="functions docblock"><li><a href="fn.__wasm_bindgen_generated_init_wasm.html">__wasm_bindgen_generated_init_wasm</a></li><li><a href="fn.init_wasm.html">init_wasm</a></li><li><a href="utils/fn.set_panic_hook.html">utils::set_panic_hook</a></li></ul><h3 id="Constants">Constants</h3><ul class="constants docblock"><li><a href="board/constant.STD_HEIGHT.html">board::STD_HEIGHT</a></li><li><a href="board/constant.STD_WIDTH.html">board::STD_WIDTH</a></li><li><a href="paint/constant.BLACK_PIECE.html">paint::BLACK_PIECE</a></li><li><a href="paint/constant.BLACK_PIECE_OUTLINE.html">paint::BLACK_PIECE_OUTLINE</a></li><li><a href="paint/constant.BLACK_SQUARE.html">paint::BLACK_SQUARE</a></li><li><a href="paint/constant.DRAW_OUTLINE.html">paint::DRAW_OUTLINE</a></li><li><a href="paint/constant.DRAW_PIECE_OUTLINES.html">paint::DRAW_PIECE_OUTLINES</a></li><li><a href="paint/constant.KING_OUTLINE.html">paint::KING_OUTLINE</a></li><li><a href="paint/constant.OUTLINE_WIDTH.html">paint::OUTLINE_WIDTH</a></li><li><a href="paint/constant.PIECE_MARGIN.html">paint::PIECE_MARGIN</a></li><li><a href="paint/constant.PIECE_OUTLINE_WIDTH.html">paint::PIECE_OUTLINE_WIDTH</a></li><li><a href="paint/constant.SQUARE_OUTLINE.html">paint::SQUARE_OUTLINE</a></li><li><a href="paint/constant.WHITE_PIECE.html">paint::WHITE_PIECE</a></li><li><a href="paint/constant.WHITE_PIECE_OUTLINE.html">paint::WHITE_PIECE_OUTLINE</a></li><li><a href="paint/constant.WHITE_SQUARE.html">paint::WHITE_SQUARE</a></li></ul></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="draught" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
</h1><h3 id="Structs">Structs</h3><ul class="structs docblock"><li><a href="board/struct.Board.html">board::Board</a></li><li><a href="board/struct.BrdIdx.html">board::BrdIdx</a></li><li><a href="board/struct.Direction.html">board::Direction</a></li><li><a href="board/struct.Piece.html">board::Piece</a></li><li><a href="board/struct.Square.html">board::Square</a></li><li><a href="board/iter/struct.PieceIterator.html">board::iter::PieceIterator</a></li><li><a href="board/iter/struct.RowIndexIterator.html">board::iter::RowIndexIterator</a></li><li><a href="board/iter/struct.RowSquareIterator.html">board::iter::RowSquareIterator</a></li><li><a href="comp/struct.Computer.html">comp::Computer</a></li><li><a href="comp/struct.Move.html">comp::Move</a></li><li><a href="game/struct.Game.html">game::Game</a></li><li><a href="paint/struct.Painter.html">paint::Painter</a></li><li><a href="player/struct.Player.html">player::Player</a></li></ul><h3 id="Enums">Enums</h3><ul class="enums docblock"><li><a href="board/enums/enum.MoveType.html">board::enums::MoveType</a></li><li><a href="board/enums/enum.Moveable.html">board::enums::Moveable</a></li><li><a href="board/enums/enum.SquareState.html">board::enums::SquareState</a></li><li><a href="board/enums/enum.Strength.html">board::enums::Strength</a></li><li><a href="board/enums/enum.Team.html">board::enums::Team</a></li></ul><h3 id="Macros">Macros</h3><ul class="macros docblock"><li><a href="macro.log.html">log</a></li></ul><h3 id="Functions">Functions</h3><ul class="functions docblock"><li><a href="fn.__wasm_bindgen_generated_init_wasm.html">__wasm_bindgen_generated_init_wasm</a></li><li><a href="fn.init_wasm.html">init_wasm</a></li><li><a href="utils/fn.set_panic_hook.html">utils::set_panic_hook</a></li></ul><h3 id="Constants">Constants</h3><ul class="constants docblock"><li><a href="board/constant.STD_HEIGHT.html">board::STD_HEIGHT</a></li><li><a href="board/constant.STD_WIDTH.html">board::STD_WIDTH</a></li><li><a href="paint/constant.BLACK_PIECE.html">paint::BLACK_PIECE</a></li><li><a href="paint/constant.BLACK_PIECE_OUTLINE.html">paint::BLACK_PIECE_OUTLINE</a></li><li><a href="paint/constant.BLACK_SQUARE.html">paint::BLACK_SQUARE</a></li><li><a href="paint/constant.DRAW_OUTLINE.html">paint::DRAW_OUTLINE</a></li><li><a href="paint/constant.DRAW_PIECE_OUTLINES.html">paint::DRAW_PIECE_OUTLINES</a></li><li><a href="paint/constant.KING_OUTLINE.html">paint::KING_OUTLINE</a></li><li><a href="paint/constant.OUTLINE_WIDTH.html">paint::OUTLINE_WIDTH</a></li><li><a href="paint/constant.PIECE_MARGIN.html">paint::PIECE_MARGIN</a></li><li><a href="paint/constant.PIECE_OUTLINE_WIDTH.html">paint::PIECE_OUTLINE_WIDTH</a></li><li><a href="paint/constant.SELECTED_PIECE.html">paint::SELECTED_PIECE</a></li><li><a href="paint/constant.SELECTED_PIECE_OUTLINE.html">paint::SELECTED_PIECE_OUTLINE</a></li><li><a href="paint/constant.SQUARE_OUTLINE.html">paint::SQUARE_OUTLINE</a></li><li><a href="paint/constant.WHITE_PIECE.html">paint::WHITE_PIECE</a></li><li><a href="paint/constant.WHITE_PIECE_OUTLINE.html">paint::WHITE_PIECE_OUTLINE</a></li><li><a href="paint/constant.WHITE_SQUARE.html">paint::WHITE_SQUARE</a></li></ul></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="draught" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
<script src="../main.js"></script></body></html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Board module for components related to the checkers board and game structure"><meta name="keywords" content="rust, rustlang, rust-lang, board"><title>draught::board - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module board</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li></ul></div><p class="location"><a href="../index.html">draught</a></p><div id="sidebar-vars" data-name="board" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">board</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/board/mod.rs.html#1-805" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Board module for components related to the checkers board and game structure</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">board</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/board/mod.rs.html#1-842" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Board module for components related to the checkers board and game structure</p>
</div><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
<table><tr class="module-item"><td><a class="mod" href="enums/index.html" title="draught::board::enums mod">enums</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="iter/index.html" title="draught::board::iter mod">iter</a></td><td class="docblock-short"></td></tr></table><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.Board.html" title="draught::board::Board struct">Board</a></td><td class="docblock-short"><p>Single state of a checkers board</p>

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="AI player logic"><meta name="keywords" content="rust, rustlang, rust-lang, comp"><title>draught::comp - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module comp</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class="location"><a href="../index.html">draught</a></p><div id="sidebar-vars" data-name="comp" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">comp</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/comp/mod.rs.html#1-161" title="goto source code">[src]</a></span></h1><div class="docblock"><p>AI player logic</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">comp</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/comp/mod.rs.html#1-151" title="goto source code">[src]</a></span></h1><div class="docblock"><p>AI player logic</p>
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.Computer.html" title="draught::comp::Computer struct">Computer</a></td><td class="docblock-short"><p>Root-level structure for managing the game as a collection of board states</p>
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Move.html" title="draught::comp::Move struct">Move</a></td><td class="docblock-short"></td></tr></table></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Top-level object for managing [`Board`]s, applying and managing turns"><meta name="keywords" content="rust, rustlang, rust-lang, game"><title>draught::game - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module game</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class="location"><a href="../index.html">draught</a></p><div id="sidebar-vars" data-name="game" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">game</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#1-150" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Top-level object for managing <a href="../board/struct.Board.html" title="Board"><code>Board</code></a>s, applying and managing turns</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">game</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#1-178" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Top-level object for managing <a href="../board/struct.Board.html" title="Board"><code>Board</code></a>s, applying and managing turns</p>
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.Game.html" title="draught::game::Game struct">Game</a></td><td class="docblock-short"><p>Root-level structure for managing the game as a collection of board states</p>
</td></tr></table></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>

View File

@ -1,24 +1,29 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Root-level structure for managing the game as a collection of board states"><meta name="keywords" content="rust, rustlang, rust-lang, Game"><title>Game in draught::game - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Struct Game</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.current">current</a><a href="#structfield.painter">painter</a><a href="#structfield.previous_boards">previous_boards</a></div><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.current_board">current_board</a><a href="#method.current_board_cells">current_board_cells</a><a href="#method.current_board_len">current_board_len</a><a href="#method.current_cell_state">current_cell_state</a><a href="#method.current_turn">current_turn</a><a href="#method.draw">draw</a><a href="#method.execute_jump">execute_jump</a><a href="#method.execute_move">execute_move</a><a href="#method.make_move">make_move</a><a href="#method.new">new</a><a href="#method.new_with_canvas">new_with_canvas</a><a href="#method.previous_board">previous_board</a><a href="#method.push_new_board">push_new_board</a><a href="#method.set_current">set_current</a><a href="#method.set_painter">set_painter</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-From%3CGame%3E">From&lt;Game&gt;</a><a href="#impl-FromWasmAbi">FromWasmAbi</a><a href="#impl-IntoWasmAbi">IntoWasmAbi</a><a href="#impl-OptionFromWasmAbi">OptionFromWasmAbi</a><a href="#impl-OptionIntoWasmAbi">OptionIntoWasmAbi</a><a href="#impl-RefFromWasmAbi">RefFromWasmAbi</a><a href="#impl-RefMutFromWasmAbi">RefMutFromWasmAbi</a><a href="#impl-WasmDescribe">WasmDescribe</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ReturnWasmAbi">ReturnWasmAbi</a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">game</a></p><div id="sidebar-vars" data-name="Game" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="../index.html">draught</a>::<wbr><a href="index.html">game</a>::<wbr><a class="struct" href="">Game</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#24-28" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct Game {
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Struct Game</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.current">current</a><a href="#structfield.painter">painter</a><a href="#structfield.previous_boards">previous_boards</a><a href="#structfield.selected_piece">selected_piece</a></div><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.clear_selected">clear_selected</a><a href="#method.current_board">current_board</a><a href="#method.current_board_cells">current_board_cells</a><a href="#method.current_board_len">current_board_len</a><a href="#method.current_cell_state">current_cell_state</a><a href="#method.current_turn">current_turn</a><a href="#method.draw">draw</a><a href="#method.execute_jump">execute_jump</a><a href="#method.execute_move">execute_move</a><a href="#method.make_move">make_move</a><a href="#method.new">new</a><a href="#method.new_with_canvas">new_with_canvas</a><a href="#method.previous_board">previous_board</a><a href="#method.push_new_board">push_new_board</a><a href="#method.set_current">set_current</a><a href="#method.set_painter">set_painter</a><a href="#method.set_selected">set_selected</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-From%3CGame%3E">From&lt;Game&gt;</a><a href="#impl-FromWasmAbi">FromWasmAbi</a><a href="#impl-IntoWasmAbi">IntoWasmAbi</a><a href="#impl-OptionFromWasmAbi">OptionFromWasmAbi</a><a href="#impl-OptionIntoWasmAbi">OptionIntoWasmAbi</a><a href="#impl-RefFromWasmAbi">RefFromWasmAbi</a><a href="#impl-RefMutFromWasmAbi">RefMutFromWasmAbi</a><a href="#impl-WasmDescribe">WasmDescribe</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ReturnWasmAbi">ReturnWasmAbi</a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">game</a></p><div id="sidebar-vars" data-name="Game" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="../index.html">draught</a>::<wbr><a href="index.html">game</a>::<wbr><a class="struct" href="">Game</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#24-29" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct Game {
current: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>,
selected_piece: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>&gt;,
previous_boards: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>&gt;,
painter: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>&gt;,
}</pre></div><div class="docblock"><p>Root-level structure for managing the game as a collection of board states</p>
</div><h2 id="fields" class="fields small-section-header">
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.current" class="structfield small-section-header"><a href="#structfield.current" class="anchor field"></a><code>current: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.previous_boards" class="structfield small-section-header"><a href="#structfield.previous_boards" class="anchor field"></a><code>previous_boards: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>&gt;</code></span><span id="structfield.painter" class="structfield small-section-header"><a href="#structfield.painter" class="anchor field"></a><code>painter: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>&gt;</code></span><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#30-40" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.previous_board" class="method"><code>pub fn <a href="#method.previous_board" class="fnname">previous_board</a>(&amp;self, turn: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.previous_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#32-34" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a read-only copy of a previous turns board</p>
</div><h4 id="method.current_board" class="method"><code>pub fn <a href="#method.current_board" class="fnname">current_board</a>(&amp;self) -&gt; &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.current_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#37-39" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-1" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#43-144" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.current_board_cells" class="method"><code>pub fn <a href="#method.current_board_cells" class="fnname">current_board_cells</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_board_cells" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#45-47" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current boards squares</p>
</div><h4 id="method.current_board_len" class="method"><code>pub fn <a href="#method.current_board_len" class="fnname">current_board_len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a href="#method.current_board_len" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#50-52" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current boards squares</p>
</div><h4 id="method.current_turn" class="method"><code>pub fn <a href="#method.current_turn" class="fnname">current_turn</a>(&amp;self) -&gt; <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code><a href="#method.current_turn" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#55-57" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turns team</p>
</div><h4 id="method.current_cell_state" class="method"><code>pub fn <a href="#method.current_cell_state" class="fnname">current_cell_state</a>(&amp;self, idx: &amp;<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -&gt; <a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_cell_state" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#59-61" title="goto source code">[src]</a></h4><h4 id="method.make_move" class="method"><code>pub fn <a href="#method.make_move" class="fnname">make_move</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -&gt; <a class="enum" href="../board/enums/enum.Moveable.html" title="enum draught::board::enums::Moveable">Moveable</a></code><a href="#method.make_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#64-86" title="goto source code">[src]</a></h4><div class="docblock"><p>Attempt to make a move given a source and destination index</p>
</div><h4 id="method.execute_move" class="method"><code>pub fn <a href="#method.execute_move" class="fnname">execute_move</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#89-92" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given move and push new board into current state</p>
</div><h4 id="method.execute_jump" class="method"><code>pub fn <a href="#method.execute_jump" class="fnname">execute_jump</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_jump" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#95-98" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given jump move and push new board into current state</p>
</div><h4 id="method.push_new_board" class="method"><code>pub fn <a href="#method.push_new_board" class="fnname">push_new_board</a>(&amp;mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.push_new_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#101-104" title="goto source code">[src]</a></h4><div class="docblock"><p>Push current board into the previous turns and set given board to current</p>
</div><h4 id="method.set_current" class="method"><code>pub fn <a href="#method.set_current" class="fnname">set_current</a>(&amp;mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.set_current" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#107-109" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
</div><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a><br>) -&gt; <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#112-120" title="goto source code">[src]</a></h4><h4 id="method.new_with_canvas" class="method"><code>pub fn <a href="#method.new_with_canvas" class="fnname">new_with_canvas</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_id: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -&gt; <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new_with_canvas" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#122-132" title="goto source code">[src]</a></h4><h4 id="method.set_painter" class="method"><code>pub fn <a href="#method.set_painter" class="fnname">set_painter</a>(&amp;mut self, value: <a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>)</code><a href="#method.set_painter" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#134-136" title="goto source code">[src]</a></h4><h4 id="method.draw" class="method"><code>pub fn <a href="#method.draw" class="fnname">draw</a>(&amp;self)</code><a href="#method.draw" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#138-143" title="goto source code">[src]</a></h4></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#146-150" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt-1" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#147-149" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.current" class="structfield small-section-header"><a href="#structfield.current" class="anchor field"></a><code>current: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.selected_piece" class="structfield small-section-header"><a href="#structfield.selected_piece" class="anchor field"></a><code>selected_piece: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>&gt;</code></span><span id="structfield.previous_boards" class="structfield small-section-header"><a href="#structfield.previous_boards" class="anchor field"></a><code>previous_boards: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>&gt;</code></span><span id="structfield.painter" class="structfield small-section-header"><a href="#structfield.painter" class="anchor field"></a><code>painter: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>&gt;</code></span><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#31-41" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.previous_board" class="method"><code>pub fn <a href="#method.previous_board" class="fnname">previous_board</a>(&amp;self, turn: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -&gt; &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.previous_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#33-35" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a read-only copy of a previous turns board</p>
</div><h4 id="method.current_board" class="method"><code>pub fn <a href="#method.current_board" class="fnname">current_board</a>(&amp;self) -&gt; &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.current_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#38-40" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-1" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#44-172" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.current_board_cells" class="method"><code>pub fn <a href="#method.current_board_cells" class="fnname">current_board_cells</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_board_cells" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#46-48" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current boards squares</p>
</div><h4 id="method.current_board_len" class="method"><code>pub fn <a href="#method.current_board_len" class="fnname">current_board_len</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a href="#method.current_board_len" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#51-53" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current boards squares</p>
</div><h4 id="method.current_turn" class="method"><code>pub fn <a href="#method.current_turn" class="fnname">current_turn</a>(&amp;self) -&gt; <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code><a href="#method.current_turn" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#56-58" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turns team</p>
</div><h4 id="method.current_cell_state" class="method"><code>pub fn <a href="#method.current_cell_state" class="fnname">current_cell_state</a>(&amp;self, idx: &amp;<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -&gt; <a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_cell_state" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#61-63" title="goto source code">[src]</a></h4><div class="docblock"><p>Get square on current board for given index</p>
</div><h4 id="method.set_selected" class="method"><code>pub fn <a href="#method.set_selected" class="fnname">set_selected</a>(&amp;mut self, idx: &amp;<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.set_selected" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#67-78" title="goto source code">[src]</a></h4><div class="docblock"><p>Set given index as selected piece
TODO: Check whether valid square?</p>
</div><h4 id="method.clear_selected" class="method"><code>pub fn <a href="#method.clear_selected" class="fnname">clear_selected</a>(&amp;mut self)</code><a href="#method.clear_selected" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#81-87" title="goto source code">[src]</a></h4><div class="docblock"><p>Clear currently selected piece</p>
</div><h4 id="method.make_move" class="method"><code>pub fn <a href="#method.make_move" class="fnname">make_move</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -&gt; <a class="enum" href="../board/enums/enum.Moveable.html" title="enum draught::board::enums::Moveable">Moveable</a></code><a href="#method.make_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#90-112" title="goto source code">[src]</a></h4><div class="docblock"><p>Attempt to make a move given a source and destination index</p>
</div><h4 id="method.execute_move" class="method"><code>pub fn <a href="#method.execute_move" class="fnname">execute_move</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#115-118" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given move and push new board into current state</p>
</div><h4 id="method.execute_jump" class="method"><code>pub fn <a href="#method.execute_jump" class="fnname">execute_jump</a>(&amp;mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_jump" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#121-124" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given jump move and push new board into current state</p>
</div><h4 id="method.push_new_board" class="method"><code>pub fn <a href="#method.push_new_board" class="fnname">push_new_board</a>(&amp;mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.push_new_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#127-130" title="goto source code">[src]</a></h4><div class="docblock"><p>Push current board into the previous turns and set given board to current</p>
</div><h4 id="method.set_current" class="method"><code>pub fn <a href="#method.set_current" class="fnname">set_current</a>(&amp;mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.set_current" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#133-135" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
</div><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a><br>) -&gt; <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#138-147" title="goto source code">[src]</a></h4><h4 id="method.new_with_canvas" class="method"><code>pub fn <a href="#method.new_with_canvas" class="fnname">new_with_canvas</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_id: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br>&nbsp;&nbsp;&nbsp;&nbsp;canvas_height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -&gt; <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new_with_canvas" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#149-160" title="goto source code">[src]</a></h4><h4 id="method.set_painter" class="method"><code>pub fn <a href="#method.set_painter" class="fnname">set_painter</a>(&amp;mut self, value: <a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>)</code><a href="#method.set_painter" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#162-164" title="goto source code">[src]</a></h4><h4 id="method.draw" class="method"><code>pub fn <a href="#method.draw" class="fnname">draw</a>(&amp;self)</code><a href="#method.draw" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#166-171" title="goto source code">[src]</a></h4></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#174-178" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt-1" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#175-177" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-From%3CGame%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>&gt; for <a class="struct" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a href="#impl-From%3CGame%3E" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.from" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(value: <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>) -&gt; Self</code><a href="#method.from" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-FromWasmAbi" class="impl"><code class="in-band">impl <a class="trait" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::traits::FromWasmAbi">FromWasmAbi</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-FromWasmAbi" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Abi-1" class="type trait-impl"><code>type <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi" class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a href="#associatedtype.Abi-1" class="anchor"></a></h4><div class='docblock'><p>The wasm ABI type that this converts from when coming back out from the
ABI boundary. <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi">Read more</a></p>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Default hex colour value for black piece outline"><meta name="keywords" content="rust, rustlang, rust-lang, BLACK_PIECE_OUTLINE"><title>BLACK_PIECE_OUTLINE in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="BLACK_PIECE_OUTLINE" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">BLACK_PIECE_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#39" title="goto source code">[src]</a></span></h1><pre class="rust const">const BLACK_PIECE_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#a60000&quot;;</pre><div class="docblock"><p>Default hex colour value for black piece outline</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">BLACK_PIECE_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#41" title="goto source code">[src]</a></span></h1><pre class="rust const">const BLACK_PIECE_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#a60000&quot;;</pre><div class="docblock"><p>Default hex colour value for black piece outline</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Whether to outline pieces"><meta name="keywords" content="rust, rustlang, rust-lang, DRAW_PIECE_OUTLINES"><title>DRAW_PIECE_OUTLINES in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="DRAW_PIECE_OUTLINES" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">DRAW_PIECE_OUTLINES</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#43" title="goto source code">[src]</a></span></h1><pre class="rust const">const DRAW_PIECE_OUTLINES: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> = true;</pre><div class="docblock"><p>Whether to outline pieces</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">DRAW_PIECE_OUTLINES</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#48" title="goto source code">[src]</a></span></h1><pre class="rust const">const DRAW_PIECE_OUTLINES: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a> = true;</pre><div class="docblock"><p>Whether to outline pieces</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Default hex colour value for black piece outline"><meta name="keywords" content="rust, rustlang, rust-lang, KING_OUTLINE"><title>KING_OUTLINE in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="KING_OUTLINE" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">KING_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#41" title="goto source code">[src]</a></span></h1><pre class="rust const">const KING_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#ffea00&quot;;</pre><div class="docblock"><p>Default hex colour value for black piece outline</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">KING_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#46" title="goto source code">[src]</a></span></h1><pre class="rust const">const KING_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#ffea00&quot;;</pre><div class="docblock"><p>Default hex colour value for black piece outline</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Margin from square to define piece radius"><meta name="keywords" content="rust, rustlang, rust-lang, PIECE_MARGIN"><title>PIECE_MARGIN in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="PIECE_MARGIN" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">PIECE_MARGIN</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#48" title="goto source code">[src]</a></span></h1><pre class="rust const">const PIECE_MARGIN: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 10.0;</pre><div class="docblock"><p>Margin from square to define piece radius</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">PIECE_MARGIN</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#53" title="goto source code">[src]</a></span></h1><pre class="rust const">const PIECE_MARGIN: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 10.0;</pre><div class="docblock"><p>Margin from square to define piece radius</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Line width for outlining pieces"><meta name="keywords" content="rust, rustlang, rust-lang, PIECE_OUTLINE_WIDTH"><title>PIECE_OUTLINE_WIDTH in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="PIECE_OUTLINE_WIDTH" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">PIECE_OUTLINE_WIDTH</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#45" title="goto source code">[src]</a></span></h1><pre class="rust const">const PIECE_OUTLINE_WIDTH: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 3.0;</pre><div class="docblock"><p>Line width for outlining pieces</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">PIECE_OUTLINE_WIDTH</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#50" title="goto source code">[src]</a></span></h1><pre class="rust const">const PIECE_OUTLINE_WIDTH: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 3.0;</pre><div class="docblock"><p>Line width for outlining pieces</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Default hex colour value for selected piece"><meta name="keywords" content="rust, rustlang, rust-lang, SELECTED_PIECE"><title>SELECTED_PIECE in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="SELECTED_PIECE" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">SELECTED_PIECE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#36" title="goto source code">[src]</a></span></h1><pre class="rust const">const SELECTED_PIECE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#fffd78&quot;;</pre><div class="docblock"><p>Default hex colour value for selected piece</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Default hex colour value for selected piece outline"><meta name="keywords" content="rust, rustlang, rust-lang, SELECTED_PIECE_OUTLINE"><title>SELECTED_PIECE_OUTLINE in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="SELECTED_PIECE_OUTLINE" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">SELECTED_PIECE_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#44" title="goto source code">[src]</a></span></h1><pre class="rust const">const SELECTED_PIECE_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#d1cf45&quot;;</pre><div class="docblock"><p>Default hex colour value for selected piece outline</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Default hex colour value for white piece outline"><meta name="keywords" content="rust, rustlang, rust-lang, WHITE_PIECE_OUTLINE"><title>WHITE_PIECE_OUTLINE in draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a></p><div id="sidebar-vars" data-name="WHITE_PIECE_OUTLINE" data-ty="constant" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">WHITE_PIECE_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#37" title="goto source code">[src]</a></span></h1><pre class="rust const">const WHITE_PIECE_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#9c9c9c&quot;;</pre><div class="docblock"><p>Default hex colour value for white piece outline</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Constant <a href="../index.html">draught</a>::<wbr><a href="index.html">paint</a>::<wbr><a class="constant" href="">WHITE_PIECE_OUTLINE</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#39" title="goto source code">[src]</a></span></h1><pre class="rust const">const WHITE_PIECE_OUTLINE: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;#9c9c9c&quot;;</pre><div class="docblock"><p>Default hex colour value for white piece outline</p>
</div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
<script src="../../main.js"></script></body></html>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Components for painting board states onto HTML canvases"><meta name="keywords" content="rust, rustlang, rust-lang, paint"><title>draught::paint - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../draught/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Module paint</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li></ul></div><p class="location"><a href="../index.html">draught</a></p><div id="sidebar-vars" data-name="paint" data-ty="mod" data-relpath="../"></div><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><button type="button" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">paint</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#1-340" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Components for painting board states onto HTML canvases</p>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">draught</a>::<wbr><a class="mod" href="">paint</a><button id="copy-path" onclick="copy_path(this)"></button></span><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span><a class="srclink" href="../../src/draught/paint.rs.html#1-385" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Components for painting board states onto HTML canvases</p>
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
<table><tr class="module-item"><td><a class="struct" href="struct.Painter.html" title="draught::paint::Painter struct">Painter</a></td><td class="docblock-short"><p>Used to paint boards onto HTML canvases</p>
</td></tr></table><h2 id="constants" class="section-header"><a href="#constants">Constants</a></h2>
@ -14,6 +14,8 @@
</td></tr><tr class="module-item"><td><a class="constant" href="constant.OUTLINE_WIDTH.html" title="draught::paint::OUTLINE_WIDTH constant">OUTLINE_WIDTH</a></td><td class="docblock-short"><p>Line width when outlining black squares</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.PIECE_MARGIN.html" title="draught::paint::PIECE_MARGIN constant">PIECE_MARGIN</a></td><td class="docblock-short"><p>Margin from square to define piece radius</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.PIECE_OUTLINE_WIDTH.html" title="draught::paint::PIECE_OUTLINE_WIDTH constant">PIECE_OUTLINE_WIDTH</a></td><td class="docblock-short"><p>Line width for outlining pieces</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.SELECTED_PIECE.html" title="draught::paint::SELECTED_PIECE constant">SELECTED_PIECE</a></td><td class="docblock-short"><p>Default hex colour value for selected piece</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.SELECTED_PIECE_OUTLINE.html" title="draught::paint::SELECTED_PIECE_OUTLINE constant">SELECTED_PIECE_OUTLINE</a></td><td class="docblock-short"><p>Default hex colour value for selected piece outline</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.SQUARE_OUTLINE.html" title="draught::paint::SQUARE_OUTLINE constant">SQUARE_OUTLINE</a></td><td class="docblock-short"><p>Default hex colour value for outline of black squares</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.WHITE_PIECE.html" title="draught::paint::WHITE_PIECE constant">WHITE_PIECE</a></td><td class="docblock-short"><p>Default hex colour value for white pieces</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.WHITE_PIECE_OUTLINE.html" title="draught::paint::WHITE_PIECE_OUTLINE constant">WHITE_PIECE_OUTLINE</a></td><td class="docblock-short"><p>Default hex colour value for white piece outline</p>

View File

@ -1 +1 @@
initSidebarItems({"constant":[["BLACK_PIECE","Default hex colour value for black pieces"],["BLACK_PIECE_OUTLINE","Default hex colour value for black piece outline"],["BLACK_SQUARE","Default hex colour value for black square background"],["DRAW_OUTLINE","Whether to outline black squares"],["DRAW_PIECE_OUTLINES","Whether to outline pieces"],["KING_OUTLINE","Default hex colour value for black piece outline"],["OUTLINE_WIDTH","Line width when outlining black squares"],["PIECE_MARGIN","Margin from square to define piece radius"],["PIECE_OUTLINE_WIDTH","Line width for outlining pieces"],["SQUARE_OUTLINE","Default hex colour value for outline of black squares"],["WHITE_PIECE","Default hex colour value for white pieces"],["WHITE_PIECE_OUTLINE","Default hex colour value for white piece outline"],["WHITE_SQUARE","Default hex colour value for white square background"]],"struct":[["Painter","Used to paint boards onto HTML canvases"]]});
initSidebarItems({"constant":[["BLACK_PIECE","Default hex colour value for black pieces"],["BLACK_PIECE_OUTLINE","Default hex colour value for black piece outline"],["BLACK_SQUARE","Default hex colour value for black square background"],["DRAW_OUTLINE","Whether to outline black squares"],["DRAW_PIECE_OUTLINES","Whether to outline pieces"],["KING_OUTLINE","Default hex colour value for black piece outline"],["OUTLINE_WIDTH","Line width when outlining black squares"],["PIECE_MARGIN","Margin from square to define piece radius"],["PIECE_OUTLINE_WIDTH","Line width for outlining pieces"],["SELECTED_PIECE","Default hex colour value for selected piece"],["SELECTED_PIECE_OUTLINE","Default hex colour value for selected piece outline"],["SQUARE_OUTLINE","Default hex colour value for outline of black squares"],["WHITE_PIECE","Default hex colour value for white pieces"],["WHITE_PIECE_OUTLINE","Default hex colour value for white piece outline"],["WHITE_SQUARE","Default hex colour value for white square background"]],"struct":[["Painter","Used to paint boards onto HTML canvases"]]});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -806,6 +806,43 @@
<span id="803">803</span>
<span id="804">804</span>
<span id="805">805</span>
<span id="806">806</span>
<span id="807">807</span>
<span id="808">808</span>
<span id="809">809</span>
<span id="810">810</span>
<span id="811">811</span>
<span id="812">812</span>
<span id="813">813</span>
<span id="814">814</span>
<span id="815">815</span>
<span id="816">816</span>
<span id="817">817</span>
<span id="818">818</span>
<span id="819">819</span>
<span id="820">820</span>
<span id="821">821</span>
<span id="822">822</span>
<span id="823">823</span>
<span id="824">824</span>
<span id="825">825</span>
<span id="826">826</span>
<span id="827">827</span>
<span id="828">828</span>
<span id="829">829</span>
<span id="830">830</span>
<span id="831">831</span>
<span id="832">832</span>
<span id="833">833</span>
<span id="834">834</span>
<span id="835">835</span>
<span id="836">836</span>
<span id="837">837</span>
<span id="838">838</span>
<span id="839">839</span>
<span id="840">840</span>
<span id="841">841</span>
<span id="842">842</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Board module for components related to the checkers board and game structure</span>
@ -1390,6 +1427,7 @@
}
}
<span class="doccomment">/// Get cell index of jumpee square given from and to locations</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">jumpee_idx</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">from</span>: <span class="ident">BrdIdx</span>, <span class="ident">to</span>: <span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">usize</span> {
<span class="kw">let</span> (<span class="ident">row_diff</span>, <span class="ident">col_diff</span>) <span class="op">=</span> <span class="ident">Board::idx_diffs</span>(<span class="ident">from</span>, <span class="ident">to</span>);
<span class="self">self</span>.<span class="ident">cell_idx</span>(
@ -1437,13 +1475,20 @@
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">white</span>: <span class="ident">isize</span> <span class="op">=</span> <span class="number">0</span>;
<span class="kw">for</span> (<span class="kw">_</span>, <span class="ident">square</span>) <span class="kw">in</span> <span class="ident">PieceIterator::new</span>(<span class="self">self</span>) {
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">x</span>) <span class="op">=</span> <span class="ident">square</span>.<span class="ident">occupant</span> {
<span class="kw">match</span> <span class="ident">x</span>.<span class="ident">team</span> {
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">piece</span>) <span class="op">=</span> <span class="ident">square</span>.<span class="ident">occupant</span> {
<span class="comment">// kings are move valuable than men</span>
<span class="kw">let</span> <span class="ident">increment</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">piece</span>.<span class="ident">strength</span> {
<span class="ident">Man</span> <span class="op">=</span><span class="op">&gt;</span> <span class="number">1</span>,
<span class="ident">King</span> <span class="op">=</span><span class="op">&gt;</span> <span class="number">2</span>,
};
<span class="kw">match</span> <span class="ident">piece</span>.<span class="ident">team</span> {
<span class="ident">Black</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">black</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>;
<span class="ident">black</span> <span class="op">+</span><span class="op">=</span> <span class="ident">increment</span>;
},
<span class="ident">White</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">white</span> <span class="op">+</span><span class="op">=</span> <span class="number">1</span>;
<span class="ident">white</span> <span class="op">+</span><span class="op">=</span> <span class="ident">increment</span>;
},
}
}
@ -1457,6 +1502,7 @@
<span class="self">self</span>.<span class="ident">cell</span>(<span class="ident">idx</span>).<span class="ident">state</span>
}
<span class="doccomment">/// Get new board derived from current with given move applied</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">apply_move</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">from</span>: <span class="ident">BrdIdx</span>, <span class="ident">to</span>: <span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Board</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">new</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">clone</span>();
@ -1475,9 +1521,12 @@
<span class="ident">Square::empty</span>() <span class="comment">// empty piece</span>
);
<span class="ident">Board::check_kinged</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">new</span>, <span class="ident">to</span>);
<span class="ident">new</span>
}
<span class="doccomment">/// Get new board derived from current with given jump applied</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">apply_jump</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">from</span>: <span class="ident">BrdIdx</span>, <span class="ident">to</span>: <span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Board</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">new</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">clone</span>();
@ -1502,9 +1551,18 @@
<span class="ident">Square::empty</span>() <span class="comment">// empty piece</span>
);
<span class="ident">Board::check_kinged</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">new</span>, <span class="ident">to</span>);
<span class="ident">new</span>
}
<span class="doccomment">/// Get row index for current team, top row for black, bottom row for white</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">king_row_idx</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">usize</span> {
<span class="kw">match</span> <span class="self">self</span>.<span class="ident">current_turn</span> {
<span class="ident">White</span> <span class="op">=</span><span class="op">&gt;</span> <span class="self">self</span>.<span class="ident">height</span> <span class="op">-</span> <span class="number">1</span>,
<span class="ident">Black</span> <span class="op">=</span><span class="op">&gt;</span> <span class="number">0</span>,
}
}
}
<span class="comment">/////////////////////////</span>
@ -1534,6 +1592,22 @@
<span class="kw">return</span> <span class="ident">from</span>.<span class="ident">team</span>.<span class="ident">opponent</span>() <span class="op">=</span><span class="op">=</span> <span class="ident">jumpee</span>.<span class="ident">team</span>
}
<span class="doccomment">/// Check and apply king strength</span>
<span class="kw">fn</span> <span class="ident">check_kinged</span>(<span class="ident">new_board</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Board</span>, <span class="ident">idx</span>: <span class="ident">BrdIdx</span>) {
<span class="kw">if</span> <span class="ident">new_board</span>.<span class="ident">king_row_idx</span>() <span class="op">=</span><span class="op">=</span> <span class="ident">idx</span>.<span class="ident">row</span> {
<span class="kw">let</span> <span class="ident">cell_idx</span> <span class="op">=</span> <span class="ident">new_board</span>.<span class="ident">cell_idx</span>(<span class="ident">idx</span>);
<span class="kw">let</span> <span class="ident">cell</span> <span class="op">=</span> <span class="ident">new_board</span>.<span class="ident">cell</span>(<span class="ident">cell_idx</span>);
<span class="kw">match</span> <span class="ident">cell</span>.<span class="ident">occupant</span> {
<span class="prelude-val">Some</span>(<span class="ident">piece</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">new_board</span>.<span class="ident">set_cell</span>(<span class="ident">cell_idx</span>, <span class="ident">Square::pc</span>(<span class="ident">piece</span>.<span class="ident">team</span>, <span class="ident">King</span>));
},
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="macro">panic!</span>(<span class="string">&quot;No piece found when checking king, idx: {}&quot;</span>, <span class="ident">idx</span>);
},
}
}
}
<span class="doccomment">/// Initialise a game board without game pieces</span>
<span class="attribute">#[<span class="ident">wasm_bindgen</span>(<span class="ident">constructor</span>)]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">width</span>: <span class="ident">usize</span>, <span class="ident">height</span>: <span class="ident">usize</span>, <span class="ident">current_turn</span>: <span class="ident">Team</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Board</span> {

View File

@ -152,16 +152,6 @@
<span id="149">149</span>
<span id="150">150</span>
<span id="151">151</span>
<span id="152">152</span>
<span id="153">153</span>
<span id="154">154</span>
<span id="155">155</span>
<span id="156">156</span>
<span id="157">157</span>
<span id="158">158</span>
<span id="159">159</span>
<span id="160">160</span>
<span id="161">161</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! AI player logic</span>
@ -202,7 +192,6 @@
<span class="doccomment">/// Root-level structure for managing the game as a collection of board states</span>
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Computer</span> {
<span class="kw">pub</span> <span class="ident">tree</span>: <span class="ident">Arena</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>,
<span class="kw">pub</span> <span class="ident">root_node_id</span>: <span class="ident">NodeId</span>,
<span class="kw">pub</span> <span class="ident">search_depth</span>: <span class="ident">usize</span>,
<span class="kw">pub</span> <span class="ident">team</span>: <span class="ident">Team</span>,
@ -213,19 +202,13 @@
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">tree</span> <span class="op">=</span> <span class="ident">Arena::new</span>();
<span class="kw">let</span> <span class="ident">root_node_id</span> <span class="op">=</span> <span class="ident">tree</span>.<span class="ident">new_node</span>(<span class="ident">initial_board</span>);
<span class="ident">Computer</span> {
<span class="ident">tree</span>,
<span class="ident">root_node_id</span>,
<span class="ident">search_depth</span>,
<span class="ident">team</span>
}
}
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">update_board</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">new_board</span>: <span class="ident">Board</span>) {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">tree</span> <span class="op">=</span> <span class="ident">Arena::new</span>();
<span class="ident">tree</span>.<span class="ident">new_node</span>(<span class="ident">new_board</span>);
<span class="self">self</span>.<span class="ident">tree</span> <span class="op">=</span> <span class="ident">tree</span>;
}
<span class="doccomment">/// Get vector of available moves for a given board</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">available_turns</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">board</span>: <span class="kw-2">&amp;</span><span class="ident">Board</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Move</span><span class="op">&gt;</span> {
<span class="comment">// allocate capacity for 2 moves per piece, likely too much but will be shrunk</span>
@ -259,7 +242,7 @@
<span class="macro">panic!</span>(<span class="string">&quot;Unable to unwrap adjacent indices, from: {}, brd: {}&quot;</span>, <span class="ident">from_brd_idx</span>, <span class="ident">board</span>);
}
<span class="comment">// iterate over adjacent indices</span>
<span class="comment">// iterate over jumpable indices</span>
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">jump</span>) <span class="op">=</span> <span class="ident">jump_op</span> {
<span class="kw">for</span> <span class="ident">i</span> <span class="kw">in</span> <span class="ident">jump</span> {
<span class="kw">let</span> <span class="ident">to_brd_idx</span> <span class="op">=</span> <span class="ident">board</span>.<span class="ident">board_index</span>(<span class="ident">i</span>);
@ -281,29 +264,26 @@
<span class="ident">moves</span>
}
<span class="comment">// pub fn gen_tree(&amp;mut self, tree: &amp;mut Arena&lt;Board&gt;, board: Board) {</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">gen_tree</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">tree</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Arena</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>, <span class="ident">board</span>: <span class="ident">Board</span>) {
<span class="comment">// let boards = self.get_move_boards(&amp;board);</span>
<span class="comment">// possible boards from given</span>
<span class="kw">let</span> <span class="ident">boards</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">get_move_boards</span>(<span class="kw-2">&amp;</span><span class="ident">board</span>);
<span class="comment">// let root_id = vec!(tree.new_node(board));</span>
<span class="comment">// let ids = self.insert_boards(boards);</span>
<span class="comment">// root node of tree</span>
<span class="kw">let</span> <span class="ident">root</span> <span class="op">=</span> <span class="ident">tree</span>.<span class="ident">new_node</span>(<span class="ident">board</span>);
<span class="comment">// for d in 0..self.search_depth {</span>
<span class="comment">// insert possible boards</span>
<span class="kw">let</span> <span class="ident">ids</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">insert_boards</span>(<span class="ident">tree</span>, <span class="ident">boards</span>);
<span class="comment">// append ids to root node</span>
<span class="ident">ids</span>.<span class="ident">iter</span>().<span class="ident">for_each</span>( <span class="op">|</span><span class="ident">id</span><span class="op">|</span> <span class="ident">root</span>.<span class="ident">append</span>(<span class="kw-2">*</span><span class="ident">id</span>, <span class="ident">tree</span>) );
<span class="comment">// for root in root_id.iter(){</span>
<span class="comment">// for id in ids.into_iter() {</span>
<span class="comment">// root.append(id, tree);</span>
<span class="comment">// }</span>
<span class="comment">// }</span>
<span class="comment">// }</span>
}
<span class="comment">// }</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">insert_boards</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">boards</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">NodeId</span><span class="op">&gt;</span> {
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">insert_boards</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">tree</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">Arena</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>, <span class="ident">boards</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">NodeId</span><span class="op">&gt;</span> {
<span class="ident">boards</span>
.<span class="ident">into_iter</span>().<span class="ident">map</span>(
<span class="op">|</span><span class="ident">b</span><span class="op">|</span> <span class="self">self</span>.<span class="ident">tree</span>.<span class="ident">new_node</span>(<span class="ident">b</span>)
<span class="op">|</span><span class="ident">b</span><span class="op">|</span> <span class="ident">tree</span>.<span class="ident">new_node</span>(<span class="ident">b</span>)
).<span class="ident">collect</span>()
}

View File

@ -151,6 +151,34 @@
<span id="148">148</span>
<span id="149">149</span>
<span id="150">150</span>
<span id="151">151</span>
<span id="152">152</span>
<span id="153">153</span>
<span id="154">154</span>
<span id="155">155</span>
<span id="156">156</span>
<span id="157">157</span>
<span id="158">158</span>
<span id="159">159</span>
<span id="160">160</span>
<span id="161">161</span>
<span id="162">162</span>
<span id="163">163</span>
<span id="164">164</span>
<span id="165">165</span>
<span id="166">166</span>
<span id="167">167</span>
<span id="168">168</span>
<span id="169">169</span>
<span id="170">170</span>
<span id="171">171</span>
<span id="172">172</span>
<span id="173">173</span>
<span id="174">174</span>
<span id="175">175</span>
<span id="176">176</span>
<span id="177">177</span>
<span id="178">178</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Top-level object for managing [`Board`]s, applying and managing turns</span>
@ -162,11 +190,11 @@
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::log</span>;
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board</span>::{<span class="ident">Square</span>, <span class="ident">BrdIdx</span>};
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board::enums</span>::{<span class="ident">Moveable</span>, <span class="ident">Team</span>};
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board::enums</span>::{<span class="ident">SquareState</span>, <span class="ident">Moveable</span>, <span class="ident">Team</span>};
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::paint::Painter</span>;
<span class="comment">// use Team::*;</span>
<span class="comment">// use SquareState::*;</span>
<span class="kw">use</span> <span class="ident">SquareState</span>::<span class="kw-2">*</span>;
<span class="kw">use</span> <span class="ident">std::fmt</span>::{<span class="ident">Display</span>};
@ -177,6 +205,7 @@
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Game</span> {
<span class="ident">current</span>: <span class="ident">Board</span>,
<span class="ident">selected_piece</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">BrdIdx</span><span class="op">&gt;</span>,
<span class="ident">previous_boards</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Board</span><span class="op">&gt;</span>,
<span class="ident">painter</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">Painter</span><span class="op">&gt;</span>
}
@ -210,10 +239,35 @@
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>
}
<span class="doccomment">/// Get square on current board for given index</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">current_cell_state</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">idx</span>: <span class="kw-2">&amp;</span><span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Square</span> {
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell</span>(<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell_idx</span>(<span class="kw-2">*</span><span class="ident">idx</span>))
}
<span class="doccomment">/// Set given index as selected piece</span>
<span class="doccomment">/// TODO: Check whether valid square?</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">set_selected</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">idx</span>: <span class="kw-2">&amp;</span><span class="ident">BrdIdx</span>) {
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell</span>(<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell_idx</span>(<span class="kw-2">*</span><span class="ident">idx</span>)).<span class="ident">state</span> <span class="op">!</span><span class="op">=</span> <span class="ident">Occupied</span> {
<span class="macro">panic!</span>(<span class="string">&quot;Tried to select an unoccupied or empty square&quot;</span>);
}
<span class="self">self</span>.<span class="ident">selected_piece</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="kw-2">*</span><span class="ident">idx</span>);
<span class="kw">match</span> <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">painter</span> {
<span class="prelude-val">Some</span>(<span class="ident">p</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">p</span>.<span class="ident">set_selected</span>(<span class="kw-2">&amp;</span><span class="prelude-val">Some</span>(<span class="kw-2">*</span><span class="ident">idx</span>)),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {},
}
}
<span class="doccomment">/// Clear currently selected piece</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">clear_selected</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="self">self</span>.<span class="ident">selected_piece</span> <span class="op">=</span> <span class="prelude-val">None</span>;
<span class="kw">match</span> <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">painter</span> {
<span class="prelude-val">Some</span>(<span class="ident">p</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">p</span>.<span class="ident">set_selected</span>(<span class="kw-2">&amp;</span><span class="prelude-val">None</span>),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {},
}
}
<span class="doccomment">/// Attempt to make a move given a source and destination index</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">make_move</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">from</span>: <span class="ident">BrdIdx</span>, <span class="ident">to</span>: <span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Moveable</span> {
<span class="kw">let</span> <span class="ident">able</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">can_move</span>(<span class="ident">from</span>, <span class="ident">to</span>);
@ -268,6 +322,7 @@
<span class="ident">current</span>: <span class="ident">Board::init_game</span>(
<span class="ident">Board::new</span>(<span class="ident">width</span>, <span class="ident">height</span>, <span class="ident">first_turn</span>), <span class="ident">piece_rows</span>,
),
<span class="ident">selected_piece</span>: <span class="prelude-val">None</span>,
<span class="ident">previous_boards</span>: <span class="ident">Vec::with_capacity</span>(<span class="number">10</span>),
<span class="ident">painter</span>: <span class="prelude-val">None</span>,
}
@ -278,6 +333,7 @@
<span class="ident">current</span>: <span class="ident">Board::init_game</span>(
<span class="ident">Board::new</span>(<span class="ident">width</span>, <span class="ident">height</span>, <span class="ident">first_turn</span>), <span class="ident">piece_rows</span>,
),
<span class="ident">selected_piece</span>: <span class="prelude-val">None</span>,
<span class="ident">previous_boards</span>: <span class="ident">Vec::with_capacity</span>(<span class="number">10</span>),
<span class="ident">painter</span>: <span class="prelude-val">Some</span>(
<span class="ident">Painter::new</span>(<span class="ident">canvas_width</span>, <span class="ident">canvas_height</span>, <span class="ident">canvas_id</span>)

View File

@ -341,6 +341,51 @@
<span id="338">338</span>
<span id="339">339</span>
<span id="340">340</span>
<span id="341">341</span>
<span id="342">342</span>
<span id="343">343</span>
<span id="344">344</span>
<span id="345">345</span>
<span id="346">346</span>
<span id="347">347</span>
<span id="348">348</span>
<span id="349">349</span>
<span id="350">350</span>
<span id="351">351</span>
<span id="352">352</span>
<span id="353">353</span>
<span id="354">354</span>
<span id="355">355</span>
<span id="356">356</span>
<span id="357">357</span>
<span id="358">358</span>
<span id="359">359</span>
<span id="360">360</span>
<span id="361">361</span>
<span id="362">362</span>
<span id="363">363</span>
<span id="364">364</span>
<span id="365">365</span>
<span id="366">366</span>
<span id="367">367</span>
<span id="368">368</span>
<span id="369">369</span>
<span id="370">370</span>
<span id="371">371</span>
<span id="372">372</span>
<span id="373">373</span>
<span id="374">374</span>
<span id="375">375</span>
<span id="376">376</span>
<span id="377">377</span>
<span id="378">378</span>
<span id="379">379</span>
<span id="380">380</span>
<span id="381">381</span>
<span id="382">382</span>
<span id="383">383</span>
<span id="384">384</span>
<span id="385">385</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Components for painting board states onto HTML canvases</span>
@ -354,7 +399,7 @@
<span class="kw">use</span> <span class="ident">std::f64</span>;
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::log</span>;
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board</span>::{<span class="ident">Board</span>};
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board</span>::{<span class="ident">Board</span>, <span class="ident">BrdIdx</span>};
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board::iter::PieceIterator</span>;
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::board::enums::Team</span>::<span class="kw-2">*</span>;
@ -376,11 +421,16 @@
<span class="kw">const</span> <span class="ident">WHITE_PIECE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#dbdbdb&quot;</span>;
<span class="doccomment">/// Default hex colour value for black pieces</span>
<span class="kw">const</span> <span class="ident">BLACK_PIECE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#ed0000&quot;</span>;
<span class="doccomment">/// Default hex colour value for selected piece</span>
<span class="kw">const</span> <span class="ident">SELECTED_PIECE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#fffd78&quot;</span>;
<span class="doccomment">/// Default hex colour value for white piece outline</span>
<span class="kw">const</span> <span class="ident">WHITE_PIECE_OUTLINE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#9c9c9c&quot;</span>;
<span class="doccomment">/// Default hex colour value for black piece outline</span>
<span class="kw">const</span> <span class="ident">BLACK_PIECE_OUTLINE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#a60000&quot;</span>;
<span class="doccomment">/// Default hex colour value for selected piece outline</span>
<span class="comment">// const SELECTED_PIECE_OUTLINE: &amp;str = &quot;#dedc73&quot;;</span>
<span class="kw">const</span> <span class="ident">SELECTED_PIECE_OUTLINE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#d1cf45&quot;</span>;
<span class="doccomment">/// Default hex colour value for black piece outline</span>
<span class="kw">const</span> <span class="ident">KING_OUTLINE</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#ffea00&quot;</span>;
<span class="doccomment">/// Whether to outline pieces</span>
@ -397,15 +447,18 @@
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Painter</span> {
<span class="ident">canvas</span>: <span class="ident">HtmlCanvasElement</span>,
<span class="ident">context</span>: <span class="ident">CanvasRenderingContext2d</span>,
<span class="ident">selected_idx</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">BrdIdx</span><span class="op">&gt;</span>,
<span class="ident">white_square</span>: <span class="ident">JsValue</span>,
<span class="ident">black_square</span>: <span class="ident">JsValue</span>,
<span class="ident">white_piece</span>: <span class="ident">JsValue</span>,
<span class="ident">black_piece</span>: <span class="ident">JsValue</span>,
<span class="ident">selected_piece</span>: <span class="ident">JsValue</span>,
<span class="ident">white_piece_line</span>: <span class="ident">JsValue</span>,
<span class="ident">black_piece_line</span>: <span class="ident">JsValue</span>,
<span class="ident">selected_piece_line</span>: <span class="ident">JsValue</span>,
<span class="ident">king_line</span>: <span class="ident">JsValue</span>,
<span class="ident">piece_lines</span>: <span class="ident">bool</span>,
@ -420,6 +473,11 @@
}
<span class="kw">impl</span> <span class="ident">Painter</span> {
<span class="doccomment">/// Set selected piece by board index</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">set_selected</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">idx</span>: <span class="kw-2">&amp;</span><span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">BrdIdx</span><span class="op">&gt;</span>) {
<span class="self">self</span>.<span class="ident">selected_idx</span> <span class="op">=</span> <span class="kw-2">*</span><span class="ident">idx</span>;
}
<span class="doccomment">/// Get a canvas by element ID</span>
<span class="kw">fn</span> <span class="ident">get_canvas</span>(<span class="ident">canvas_id</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">HtmlCanvasElement</span> {
<span class="comment">// JS WINDOW</span>
@ -486,15 +544,18 @@
<span class="ident">canvas</span>,
<span class="ident">context</span>,
<span class="ident">width</span>, <span class="ident">height</span>,
<span class="ident">selected_idx</span>: <span class="prelude-val">None</span>,
<span class="ident">white_square</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_SQUARE</span>),
<span class="ident">black_square</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_SQUARE</span>),
<span class="ident">white_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_PIECE</span>),
<span class="ident">black_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_PIECE</span>),
<span class="ident">selected_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SELECTED_PIECE</span>),
<span class="ident">white_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_PIECE_OUTLINE</span>),
<span class="ident">black_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_PIECE_OUTLINE</span>),
<span class="ident">selected_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SELECTED_PIECE_OUTLINE</span>),
<span class="ident">king_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">KING_OUTLINE</span>),
<span class="ident">piece_lines</span>: <span class="ident">DRAW_PIECE_OUTLINES</span>,
<span class="ident">piece_line_width</span>: <span class="ident">PIECE_OUTLINE_WIDTH</span>,
@ -516,15 +577,18 @@
<span class="ident">canvas</span>,
<span class="ident">context</span>,
<span class="ident">width</span>, <span class="ident">height</span>,
<span class="ident">selected_idx</span>: <span class="prelude-val">None</span>,
<span class="ident">white_square</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_SQUARE</span>),
<span class="ident">black_square</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_SQUARE</span>),
<span class="ident">white_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_PIECE</span>),
<span class="ident">black_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_PIECE</span>),
<span class="ident">selected_piece</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SELECTED_PIECE</span>),
<span class="ident">white_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">WHITE_PIECE_OUTLINE</span>),
<span class="ident">black_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">BLACK_PIECE_OUTLINE</span>),
<span class="ident">selected_piece_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SELECTED_PIECE_OUTLINE</span>),
<span class="ident">king_line</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">KING_OUTLINE</span>),
<span class="ident">piece_lines</span>: <span class="ident">DRAW_PIECE_OUTLINES</span>,
<span class="ident">piece_line_width</span>: <span class="ident">PIECE_OUTLINE_WIDTH</span>,
@ -680,6 +744,32 @@
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="macro">panic!</span>(<span class="string">&quot;No piece found when attempting to draw, idx: {}, square: {:?}&quot;</span>, <span class="ident">idx</span>, <span class="ident">square</span>),
}
}
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">selected_idx</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">selected_idx</span> {
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">set_fill_style</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">selected_piece</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">set_stroke_style</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">selected_piece_line</span>);
<span class="kw">let</span> <span class="ident">center_x</span>: <span class="ident">f64</span> <span class="op">=</span> (<span class="ident">selected_idx</span>.<span class="ident">col</span> <span class="kw">as</span> <span class="ident">f64</span> <span class="op">*</span> <span class="ident">cell_width</span> <span class="kw">as</span> <span class="ident">f64</span>) <span class="op">+</span> (<span class="ident">cell_width</span> <span class="kw">as</span> <span class="ident">f64</span>) <span class="op">/</span> <span class="number">2.0</span>;
<span class="kw">let</span> <span class="ident">center_y</span>: <span class="ident">f64</span> <span class="op">=</span> (<span class="ident">selected_idx</span>.<span class="ident">row</span> <span class="kw">as</span> <span class="ident">f64</span> <span class="op">*</span> <span class="ident">cell_height</span> <span class="kw">as</span> <span class="ident">f64</span>) <span class="op">+</span> (<span class="ident">cell_height</span> <span class="kw">as</span> <span class="ident">f64</span>) <span class="op">/</span> <span class="number">2.0</span>;
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">begin_path</span>();
<span class="kw">match</span> <span class="self">self</span>.<span class="ident">context</span>.<span class="ident">arc</span>(
<span class="ident">center_x</span>,
<span class="ident">center_y</span>,
(<span class="ident">cell_width</span> <span class="kw">as</span> <span class="ident">f64</span> <span class="op">/</span> <span class="number">2.0</span>) <span class="op">-</span> <span class="ident">PIECE_MARGIN</span>, <span class="comment">// radius </span>
<span class="number">0.0</span>, <span class="comment">// start angle</span>
<span class="ident">f64::consts::PI</span> <span class="op">*</span> <span class="number">2.0</span>) <span class="comment">// end angle</span>
{
<span class="prelude-val">Ok</span>(<span class="ident">res</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">res</span>,
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="macro">log!</span>(<span class="string">&quot;Failed to paint selected piece, idx: {}, {:?}&quot;</span>, <span class="ident">selected_idx</span>, <span class="ident">err</span>),
};
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">fill</span>();
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">piece_lines</span> {
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">set_line_width</span>(<span class="self">self</span>.<span class="ident">piece_line_width</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">stroke</span>()
}
}
}
}</pre></div>
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="draught" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>

View File

@ -41,16 +41,18 @@
</div>
<div class="row p-3">
<div class="col-sm-12">
<a href="doc/draught" class="btn btn-secondary">Docs</a>
<!-- <button id="startBtn" class="btn btn-primary">Start</button> -->
<a href="doc/draught" class="btn btn-secondary" target="_blank">Docs</a>
<button id="startBtn" class="btn btn-primary">Start</button>
</div>
</div>
<div class="row p-3">
<div class="col-sm-6">
<div class="col-sm-12">
<h1 id="team-p"></h1>
</div>
<div class="col-sm-6">
</div>
<div class="row p-3">
<div class="col-sm-12">
<p hidden id="status-p"></p>
<div hidden id="status-d" class="alert alert-danger" role="alert">
A simple success alert—check it out!