This commit is contained in:
Sarsoo 2021-07-14 13:11:40 +00:00
parent 34b33fceef
commit 082181680e
31 changed files with 312 additions and 136 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 1.0.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.BoardNode.html">comp::BoardNode</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></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>
</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.BoardNode.html">comp::BoardNode</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></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><li><a href="macro.log_error.html">log_error</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_OUTLINE_PROPORTION.html">paint::PIECE_OUTLINE_PROPORTION</a></li><li><a href="paint/constant.PIECE_PROPORTION.html">paint::PIECE_PROPORTION</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="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-381" 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-425" 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.BoardNode.html" title="draught::comp::BoardNode struct">BoardNode</a></td><td class="docblock-short"><p>For storing boards in the AI tree, stores board with score for comparisons</p>
</td></tr><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>

View File

@ -1,18 +1,18 @@
<!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="For storing boards in the AI tree, stores board with score for comparisons"><meta name="keywords" content="rust, rustlang, rust-lang, BoardNode"><title>BoardNode in 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 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 BoardNode</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.board">board</a><a href="#structfield.score">score</a></div><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.brd">brd</a><a href="#method.new">new</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Eq">Eq</a><a href="#impl-PartialEq%3CBoardNode%3E">PartialEq&lt;BoardNode&gt;</a><a href="#impl-StructuralEq">StructuralEq</a><a href="#impl-StructuralPartialEq">StructuralPartialEq</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-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a><a href="#impl-VZip%3CV%3E">VZip&lt;V&gt;</a></div></div><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">comp</a></p><div id="sidebar-vars" data-name="BoardNode" 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">comp</a>::<wbr><a class="struct" href="">BoardNode</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#41-44" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct BoardNode {
<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">comp</a>::<wbr><a class="struct" href="">BoardNode</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#44-47" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct BoardNode {
pub board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>,
pub score: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>,
}</pre></div><div class="docblock"><p>For storing boards in the AI tree, stores board with score for comparisons</p>
</div><h2 id="fields" class="fields small-section-header">
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.board" class="structfield small-section-header"><a href="#structfield.board" class="anchor field"></a><code>board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.score" class="structfield small-section-header"><a href="#structfield.score" class="anchor field"></a><code>score: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></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.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#46-58" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>, score: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#47-51" title="goto source code">[src]</a></h4><h4 id="method.brd" class="method"><code>pub fn <a href="#method.brd" class="fnname">brd</a>(board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.brd" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#53-57" 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-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.clone" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.clone" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.board" class="structfield small-section-header"><a href="#structfield.board" class="anchor field"></a><code>board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.score" class="structfield small-section-header"><a href="#structfield.score" class="anchor field"></a><code>score: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></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.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#49-61" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>, score: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#50-54" title="goto source code">[src]</a></h4><h4 id="method.brd" class="method"><code>pub fn <a href="#method.brd" class="fnname">brd</a>(board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.brd" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#56-60" 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-Clone" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Clone" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.clone" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#method.clone" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id="method.clone_from" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div></details><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.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" 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/comp/mod.rs.html#40" 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-PartialEq%3CBoardNode%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt; for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-PartialEq%3CBoardNode%3E" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.eq" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href="#method.eq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
</div></div></details><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.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" 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/comp/mod.rs.html#43" 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-PartialEq%3CBoardNode%3E" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt; for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-PartialEq%3CBoardNode%3E" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.eq" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href="#method.eq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id="method.ne" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href="#method.ne" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
</div></div></details><h3 id="impl-Eq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h3><h3 id="impl-StructuralEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralEq.html" title="trait core::marker::StructuralEq">StructuralEq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-StructuralEq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h3><h3 id="impl-StructuralPartialEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-StructuralPartialEq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#40" title="goto source code">[src]</a></h3></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Send" class="anchor"></a></h3><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Sync" class="anchor"></a></h3><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Unpin" class="anchor"></a></h3><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.type_id" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a href="#method.type_id" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div><h4 id="method.ne" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code><a href="#method.ne" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>This method tests for <code>!=</code>.</p>
</div></div></details><h3 id="impl-Eq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Eq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h3><h3 id="impl-StructuralEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralEq.html" title="trait core::marker::StructuralEq">StructuralEq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-StructuralEq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h3><h3 id="impl-StructuralPartialEq" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-StructuralPartialEq" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#43" title="goto source code">[src]</a></h3></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Send" class="anchor"></a></h3><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Sync" class="anchor"></a></h3><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-Unpin" class="anchor"></a></h3><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.type_id" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a href="#method.type_id" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a href="#method.borrow" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a href="#method.borrow_mut" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-From%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href="#impl-From%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#544-548" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.from" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</code><a href="#method.from" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>

View File

@ -1,25 +1,27 @@
<!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, Computer"><title>Computer in 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 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 Computer</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.last_node_count">last_node_count</a><a href="#structfield.search_depth">search_depth</a><a href="#structfield.team">team</a></div><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.available_turns">available_turns</a><a href="#method.best_score">best_score</a><a href="#method.expand_layer">expand_layer</a><a href="#method.expand_node">expand_node</a><a href="#method.gen_tree">gen_tree</a><a href="#method.get_leaf_nodes">get_leaf_nodes</a><a href="#method.get_move">get_move</a><a href="#method.get_move_boards">get_move_boards</a><a href="#method.insert_board_scores">insert_board_scores</a><a href="#method.insert_boards">insert_boards</a><a href="#method.new">new</a><a href="#method.propagate_scores">propagate_scores</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</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-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a><a href="#impl-VZip%3CV%3E">VZip&lt;V&gt;</a></div></div><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">comp</a></p><div id="sidebar-vars" data-name="Computer" 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">comp</a>::<wbr><a class="struct" href="">Computer</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#62-66" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct Computer {
<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 Computer</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.last_node_count">last_node_count</a><a href="#structfield.perfect_chance">perfect_chance</a><a href="#structfield.search_depth">search_depth</a><a href="#structfield.team">team</a></div><a class="sidebar-title" href="#implementations">Methods</a><div class="sidebar-links"><a href="#method.available_turns">available_turns</a><a href="#method.best_score">best_score</a><a href="#method.expand_layer">expand_layer</a><a href="#method.expand_node">expand_node</a><a href="#method.gen_tree">gen_tree</a><a href="#method.get_leaf_nodes">get_leaf_nodes</a><a href="#method.get_move">get_move</a><a href="#method.get_move_boards">get_move_boards</a><a href="#method.insert_board_scores">insert_board_scores</a><a href="#method.insert_boards">insert_boards</a><a href="#method.new">new</a><a href="#method.propagate_scores">propagate_scores</a><a href="#method.random_choice">random_choice</a></div><a class="sidebar-title" href="#trait-implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</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-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a><a href="#impl-VZip%3CV%3E">VZip&lt;V&gt;</a></div></div><p class="location"><a href="../index.html">draught</a>::<wbr><a href="index.html">comp</a></p><div id="sidebar-vars" data-name="Computer" 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">comp</a>::<wbr><a class="struct" href="">Computer</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#65-70" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct">pub struct Computer {
pub search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
pub team: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>,
pub last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
pub perfect_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>,
}</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.search_depth" class="structfield small-section-header"><a href="#structfield.search_depth" class="anchor field"></a><code>search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.team" class="structfield small-section-header"><a href="#structfield.team" class="anchor field"></a><code>team: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code></span><span id="structfield.last_node_count" class="structfield small-section-header"><a href="#structfield.last_node_count" class="anchor field"></a><code>last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></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.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#68-381" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, team: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>) -&gt; <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#69-75" title="goto source code">[src]</a></h4><h4 id="method.available_turns" class="method"><code>fn <a href="#method.available_turns" class="fnname">available_turns</a>(&amp;self, board: &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <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="struct.Move.html" title="struct draught::comp::Move">Move</a>&gt;</code><a href="#method.available_turns" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#78-131" title="goto source code">[src]</a></h4><div class="docblock"><p>Get vector of available moves for a given board</p>
</div><h4 id="method.gen_tree" class="method"><code>fn <a href="#method.gen_tree" class="fnname">gen_tree</a>(&amp;mut self, tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; NodeId</code><a href="#method.gen_tree" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#134-150" title="goto source code">[src]</a></h4><div class="docblock"><p>Generate tree of boards to given search depth, return root node</p>
</div><h4 id="method.propagate_scores" class="method"><code>fn <a href="#method.propagate_scores" class="fnname">propagate_scores</a>(tree: Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, root: NodeId) -&gt; Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;</code><a href="#method.propagate_scores" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#153-195" title="goto source code">[src]</a></h4><div class="docblock"><p>Propagate scores up the tree employing MiniMax algorithm</p>
</div><h4 id="method.best_score" class="method"><code>fn <a href="#method.best_score" class="fnname">best_score</a>(board: &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>, children_scores: <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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href="#method.best_score" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#198-210" title="goto source code">[src]</a></h4><div class="docblock"><p>Get best of given scores for given team</p>
</div><h4 id="method.insert_board_scores" class="method"><code>fn <a href="#method.insert_board_scores" class="fnname">insert_board_scores</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;nodes: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;<br>)</code><a href="#method.insert_board_scores" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#214-226" title="goto source code">[src]</a></h4><div class="docblock"><p>For given NodeIDs, insert score of board into tree
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.search_depth" class="structfield small-section-header"><a href="#structfield.search_depth" class="anchor field"></a><code>search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.team" class="structfield small-section-header"><a href="#structfield.team" class="anchor field"></a><code>team: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code></span><span id="structfield.last_node_count" class="structfield small-section-header"><a href="#structfield.last_node_count" class="anchor field"></a><code>last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.perfect_chance" class="structfield small-section-header"><a href="#structfield.perfect_chance" class="anchor field"></a><code>perfect_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></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.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#72-425" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, team: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>, perfect_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>) -&gt; <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#73-80" title="goto source code">[src]</a></h4><h4 id="method.available_turns" class="method"><code>fn <a href="#method.available_turns" class="fnname">available_turns</a>(&amp;self, board: &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <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="struct.Move.html" title="struct draught::comp::Move">Move</a>&gt;</code><a href="#method.available_turns" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#83-136" title="goto source code">[src]</a></h4><div class="docblock"><p>Get vector of available moves for a given board</p>
</div><h4 id="method.gen_tree" class="method"><code>fn <a href="#method.gen_tree" class="fnname">gen_tree</a>(&amp;mut self, tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; NodeId</code><a href="#method.gen_tree" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#139-155" title="goto source code">[src]</a></h4><div class="docblock"><p>Generate tree of boards to given search depth, return root node</p>
</div><h4 id="method.propagate_scores" class="method"><code>fn <a href="#method.propagate_scores" class="fnname">propagate_scores</a>(tree: Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, root: NodeId) -&gt; Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;</code><a href="#method.propagate_scores" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#158-200" title="goto source code">[src]</a></h4><div class="docblock"><p>Propagate scores up the tree employing MiniMax algorithm</p>
</div><h4 id="method.best_score" class="method"><code>fn <a href="#method.best_score" class="fnname">best_score</a>(board: &amp;<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>, children_scores: <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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href="#method.best_score" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#203-215" title="goto source code">[src]</a></h4><div class="docblock"><p>Get best of given scores for given team</p>
</div><h4 id="method.insert_board_scores" class="method"><code>fn <a href="#method.insert_board_scores" class="fnname">insert_board_scores</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;nodes: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;<br>)</code><a href="#method.insert_board_scores" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#219-231" title="goto source code">[src]</a></h4><div class="docblock"><p>For given NodeIDs, insert score of board into tree
Used for leaf nodes ready for propagating up tree</p>
</div><h4 id="method.get_leaf_nodes" class="method"><code>fn <a href="#method.get_leaf_nodes" class="fnname">get_leaf_nodes</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;root: NodeId<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.get_leaf_nodes" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#229-247" title="goto source code">[src]</a></h4><div class="docblock"><p>Traverse tree from given root ID and get NodeIDs of leaf nodes (those without children)</p>
</div><h4 id="method.expand_layer" class="method"><code>fn <a href="#method.expand_layer" class="fnname">expand_layer</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;nodes: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.expand_layer" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#250-257" title="goto source code">[src]</a></h4><div class="docblock"><p>Expand all given nodes and return newly inserted layer of nodes</p>
</div><h4 id="method.expand_node" class="method"><code>fn <a href="#method.expand_node" class="fnname">expand_node</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;node: NodeId<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.expand_node" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#260-282" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert all possible next boards as children of given board node</p>
</div><h4 id="method.insert_boards" class="method"><code>fn <a href="#method.insert_boards" class="fnname">insert_boards</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;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="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.insert_boards" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#285-291" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert given boards into tree</p>
</div><h4 id="method.get_move_boards" class="method"><code>fn <a href="#method.get_move_boards" class="fnname">get_move_boards</a>(&amp;self, board: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <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="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;</code><a href="#method.get_move_boards" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#294-309" title="goto source code">[src]</a></h4><div class="docblock"><p>Get all possible next boards from given board</p>
</div><h4 id="method.get_move" class="method"><code>pub fn <a href="#method.get_move" class="fnname">get_move</a>(&amp;mut self, brd: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <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.Board.html" title="struct draught::board::Board">Board</a>&gt;</code><a href="#method.get_move" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#312-380" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a new board based on the given using MiniMax to make decisions </p>
</div></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.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#61" 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/comp/mod.rs.html#61" 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><h4 id="method.get_leaf_nodes" class="method"><code>fn <a href="#method.get_leaf_nodes" class="fnname">get_leaf_nodes</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;root: NodeId<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.get_leaf_nodes" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#234-252" title="goto source code">[src]</a></h4><div class="docblock"><p>Traverse tree from given root ID and get NodeIDs of leaf nodes (those without children)</p>
</div><h4 id="method.expand_layer" class="method"><code>fn <a href="#method.expand_layer" class="fnname">expand_layer</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;nodes: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.expand_layer" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#255-262" title="goto source code">[src]</a></h4><div class="docblock"><p>Expand all given nodes and return newly inserted layer of nodes</p>
</div><h4 id="method.expand_node" class="method"><code>fn <a href="#method.expand_node" class="fnname">expand_node</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;node: NodeId<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.expand_node" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#265-287" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert all possible next boards as children of given board node</p>
</div><h4 id="method.insert_boards" class="method"><code>fn <a href="#method.insert_boards" class="fnname">insert_boards</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;mut self, <br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;mut Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;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="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;<br>) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;</code><a href="#method.insert_boards" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#290-296" title="goto source code">[src]</a></h4><div class="docblock"><p>Insert given boards into tree</p>
</div><h4 id="method.get_move_boards" class="method"><code>fn <a href="#method.get_move_boards" class="fnname">get_move_boards</a>(&amp;self, board: &amp;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>) -&gt; <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="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;</code><a href="#method.get_move_boards" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#299-314" title="goto source code">[src]</a></h4><div class="docblock"><p>Get all possible next boards from given board</p>
</div><h4 id="method.get_move" class="method"><code>pub fn <a href="#method.get_move" class="fnname">get_move</a>(&amp;mut self, brd: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>) -&gt; <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.Board.html" title="struct draught::board::Board">Board</a>&gt;</code><a href="#method.get_move" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#317-413" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a new board based on the given using MiniMax to make decisions </p>
</div><h4 id="method.random_choice" class="method"><code>fn <a href="#method.random_choice" class="fnname">random_choice</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;tree: &amp;Arena&lt;<a class="struct" href="struct.BoardNode.html" title="struct draught::comp::BoardNode">BoardNode</a>&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;possible_moves: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;NodeId&gt;, <br>&nbsp;&nbsp;&nbsp;&nbsp;rng: &amp;mut <a class="struct" href="https://rust-random.github.io/rand/rand/rngs/thread/struct.ThreadRng.html" title="struct rand::rngs::thread::ThreadRng">ThreadRng</a><br>) -&gt; <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.random_choice" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#416-424" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a random board from possible node IDs and associated tree</p>
</div></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.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/comp/mod.rs.html#64" 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/comp/mod.rs.html#64" 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></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><h3 id="impl-RefUnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-RefUnwindSafe" class="anchor"></a></h3><h3 id="impl-Send" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-Send" class="anchor"></a></h3><h3 id="impl-Sync" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-Sync" class="anchor"></a></h3><h3 id="impl-Unpin" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-Unpin" class="anchor"></a></h3><h3 id="impl-UnwindSafe" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Computer.html" title="struct draught::comp::Computer">Computer</a></code><a href="#impl-UnwindSafe" class="anchor"></a></h3></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Any" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Any" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#131-135" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.type_id" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a href="#method.type_id" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Borrow%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-Borrow%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a href="#method.borrow" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-BorrowMut%3CT%3E" class="impl"><code class="in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.borrow_mut" class="method hidden trait-impl"><code>pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a href="#method.borrow_mut" class="anchor"></a><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<!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="API documentation for the Rust `__wasm_bindgen_generated_init_wasm` fn in crate `draught`."><meta name="keywords" content="rust, rustlang, rust-lang, __wasm_bindgen_generated_init_wasm"><title>__wasm_bindgen_generated_init_wasm in draught - 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 fn"><!--[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></p><div id="sidebar-vars" data-name="__wasm_bindgen_generated_init_wasm" data-ty="fn" 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">Function <a href="index.html">draught</a>::<wbr><a class="fn" href="">__wasm_bindgen_generated_init_wasm</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/lib.rs.html#33" title="goto source code">[src]</a></span></h1><pre class="rust fn">pub extern &quot;C&quot; fn __wasm_bindgen_generated_init_wasm(<br>) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a> as <a class="trait" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.ReturnWasmAbi.html" title="trait wasm_bindgen::convert::traits::ReturnWasmAbi">ReturnWasmAbi</a>&gt;::<a class="type" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::traits::ReturnWasmAbi::Abi">Abi</a></pre></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>
<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">Function <a href="index.html">draught</a>::<wbr><a class="fn" href="">__wasm_bindgen_generated_init_wasm</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/lib.rs.html#39" title="goto source code">[src]</a></span></h1><pre class="rust fn">pub extern &quot;C&quot; fn __wasm_bindgen_generated_init_wasm(<br>) -&gt; &lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a> as <a class="trait" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.ReturnWasmAbi.html" title="trait wasm_bindgen::convert::traits::ReturnWasmAbi">ReturnWasmAbi</a>&gt;::<a class="type" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.ReturnWasmAbi.html#associatedtype.Abi" title="type wasm_bindgen::convert::traits::ReturnWasmAbi::Abi">Abi</a></pre></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,5 +1,5 @@
<!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="API documentation for the Rust `init_wasm` fn in crate `draught`."><meta name="keywords" content="rust, rustlang, rust-lang, init_wasm"><title>init_wasm in draught - 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 fn"><!--[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></p><div id="sidebar-vars" data-name="init_wasm" data-ty="fn" 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">Function <a href="index.html">draught</a>::<wbr><a class="fn" href="">init_wasm</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/lib.rs.html#34-37" title="goto source code">[src]</a></span></h1><pre class="rust fn">pub fn init_wasm()</pre></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>
<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">Function <a href="index.html">draught</a>::<wbr><a class="fn" href="">init_wasm</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/lib.rs.html#40-43" title="goto source code">[src]</a></span></h1><pre class="rust fn">pub fn init_wasm()</pre></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="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-234" 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-251" 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,39 +1,42 @@
<!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.last_node_count">last_node_count</a><a href="#structfield.painter">painter</a><a href="#structfield.previous_boards">previous_boards</a><a href="#structfield.search_depth">search_depth</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.ai_move">ai_move</a><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.has_won">has_won</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.score">score</a><a href="#method.set_current">set_current</a><a href="#method.set_painter">set_painter</a><a href="#method.set_search_depth">set_search_depth</a><a href="#method.set_selected">set_selected</a><a href="#method.winning">winning</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><a href="#impl-VZip%3CV%3E">VZip&lt;V&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#25-32" 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.last_node_count">last_node_count</a><a href="#structfield.painter">painter</a><a href="#structfield.perfect_chance">perfect_chance</a><a href="#structfield.previous_boards">previous_boards</a><a href="#structfield.search_depth">search_depth</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.ai_move">ai_move</a><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.has_won">has_won</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.score">score</a><a href="#method.set_current">set_current</a><a href="#method.set_painter">set_painter</a><a href="#method.set_perfect_chance">set_perfect_chance</a><a href="#method.set_search_depth">set_search_depth</a><a href="#method.set_selected">set_selected</a><a href="#method.winning">winning</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><a href="#impl-VZip%3CV%3E">VZip&lt;V&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#25-33" 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;,
search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
pub last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>,
pub perfect_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>,
}</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.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><span id="structfield.search_depth" class="structfield small-section-header"><a href="#structfield.search_depth" class="anchor field"></a><code>search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.last_node_count" class="structfield small-section-header"><a href="#structfield.last_node_count" class="anchor field"></a><code>last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></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#34-44" 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#36-38" 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#41-43" 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#47-228" 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#49-51" 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#54-56" 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#59-61" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turns team</p>
</div><h4 id="method.score" class="method"><code>pub fn <a href="#method.score" class="fnname">score</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href="#method.score" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#64-66" title="goto source code">[src]</a></h4><div class="docblock"><p>Current boards score</p>
</div><h4 id="method.winning" class="method"><code>pub fn <a href="#method.winning" class="fnname">winning</a>(&amp;self) -&gt; <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="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>&gt;</code><a href="#method.winning" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#69-79" title="goto source code">[src]</a></h4><div class="docblock"><p>Get currently winning player</p>
</div><h4 id="method.has_won" class="method"><code>pub fn <a href="#method.has_won" class="fnname">has_won</a>(&amp;self) -&gt; <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="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>&gt;</code><a href="#method.has_won" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#82-91" title="goto source code">[src]</a></h4><div class="docblock"><p>Check if a player has won</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#94-96" 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_search_depth" class="method"><code>pub fn <a href="#method.set_search_depth" class="fnname">set_search_depth</a>(&amp;mut self, search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a href="#method.set_search_depth" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#98-100" title="goto source code">[src]</a></h4><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#104-115" title="goto source code">[src]</a></h4><div class="docblock"><p>Set given index as selected piece
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><span id="structfield.search_depth" class="structfield small-section-header"><a href="#structfield.search_depth" class="anchor field"></a><code>search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.last_node_count" class="structfield small-section-header"><a href="#structfield.last_node_count" class="anchor field"></a><code>last_node_count: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code></span><span id="structfield.perfect_chance" class="structfield small-section-header"><a href="#structfield.perfect_chance" class="anchor field"></a><code>perfect_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a></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#35-45" 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#37-39" 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#42-44" 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#48-245" 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#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_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#55-57" 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#60-62" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turns team</p>
</div><h4 id="method.score" class="method"><code>pub fn <a href="#method.score" class="fnname">score</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a></code><a href="#method.score" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#65-67" title="goto source code">[src]</a></h4><div class="docblock"><p>Current boards score</p>
</div><h4 id="method.winning" class="method"><code>pub fn <a href="#method.winning" class="fnname">winning</a>(&amp;self) -&gt; <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="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>&gt;</code><a href="#method.winning" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#70-80" title="goto source code">[src]</a></h4><div class="docblock"><p>Get currently winning player</p>
</div><h4 id="method.has_won" class="method"><code>pub fn <a href="#method.has_won" class="fnname">has_won</a>(&amp;self) -&gt; <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="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>&gt;</code><a href="#method.has_won" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#83-92" title="goto source code">[src]</a></h4><div class="docblock"><p>Check if a player has won</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#95-97" 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_search_depth" class="method"><code>pub fn <a href="#method.set_search_depth" class="fnname">set_search_depth</a>(&amp;mut self, search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>)</code><a href="#method.set_search_depth" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#100-102" title="goto source code">[src]</a></h4><div class="docblock"><p>Set tree depth for AI to search to</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#106-117" 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#118-124" 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#127-146" 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#149-152" 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#155-158" 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#161-164" 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#167-169" 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>&nbsp;&nbsp;&nbsp;&nbsp;search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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#173-184" title="goto source code">[src]</a></h4><div class="docblock"><p>Get new game without board renderer</p>
</div><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;search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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#187-200" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a new game with canvas ID and dimensions</p>
</div><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#203-205" title="goto source code">[src]</a></h4><div class="docblock"><p>Set painter for rendering boards</p>
</div><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#208-213" title="goto source code">[src]</a></h4><div class="docblock"><p>Draw current board using painter if exists</p>
</div><h4 id="method.ai_move" class="method"><code>pub fn <a href="#method.ai_move" class="fnname">ai_move</a>(&amp;mut self)</code><a href="#method.ai_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#216-227" title="goto source code">[src]</a></h4><div class="docblock"><p>Create computer, get move from current board and update current board</p>
</div><h4 id="method.set_perfect_chance" class="method"><code>pub fn <a href="#method.set_perfect_chance" class="fnname">set_perfect_chance</a>(&amp;mut self, new_chance: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a>)</code><a href="#method.set_perfect_chance" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#120-122" title="goto source code">[src]</a></h4><div class="docblock"><p>Set proportion of perfect moves from AI</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#125-131" 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#134-153" 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#156-159" 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#162-165" 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#168-171" 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#174-176" 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>&nbsp;&nbsp;&nbsp;&nbsp;search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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#180-192" title="goto source code">[src]</a></h4><div class="docblock"><p>Get new game without board renderer</p>
</div><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;search_depth: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</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#195-209" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a new game with canvas ID and dimensions</p>
</div><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#212-214" title="goto source code">[src]</a></h4><div class="docblock"><p>Set painter for rendering boards</p>
</div><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#217-222" title="goto source code">[src]</a></h4><div class="docblock"><p>Draw current board using painter if exists</p>
</div><h4 id="method.ai_move" class="method"><code>pub fn <a href="#method.ai_move" class="fnname">ai_move</a>(&amp;mut self)</code><a href="#method.ai_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#225-244" title="goto source code">[src]</a></h4><div class="docblock"><p>Create computer, get move from current board and update current board</p>
</div></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#24" 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#24" 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#230-234" 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#231-233" 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-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#247-251" 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#248-250" 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#23" 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#23" 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#23" 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,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="Draught"><meta name="keywords" content="rust, rustlang, rust-lang, draught"><title>draught - 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">Crate draught</p><div class="block version"><p>Version 1.0.0</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all draught's items</p></a><div class="block items"><ul><li><a href="#reexports">Re-exports</a></li><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li><li><a href="#functions">Functions</a></li></ul></div><p class="location"></p><div id="sidebar-vars" data-name="draught" 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">Crate <a class="mod" href="">draught</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/lib.rs.html#1-37" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Draught</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">Crate <a class="mod" href="">draught</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/lib.rs.html#1-43" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Draught</p>
<p>An implementation of checkers/draughts in Rust WebAssembly with a minimax AI player</p>
</div><h2 id="reexports" class="section-header"><a href="#reexports">Re-exports</a></h2>
<table><tr class="import-item"><td><code>pub use board::<a class="struct" href="board/struct.Board.html" title="struct draught::board::Board">Board</a>;</code></td><td class="docblock-short"></td></tr><tr class="import-item"><td><code>pub use game::<a class="struct" href="game/struct.Game.html" title="struct draught::game::Game">Game</a>;</code></td><td class="docblock-short"></td></tr><tr class="import-item"><td><code>pub use comp::<a class="struct" href="comp/struct.Computer.html" title="struct draught::comp::Computer">Computer</a>;</code></td><td class="docblock-short"></td></tr><tr class="import-item"><td><code>pub use paint::<a class="struct" href="paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>;</code></td><td class="docblock-short"></td></tr></table><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
@ -11,6 +11,6 @@
</td></tr><tr class="module-item"><td><a class="mod" href="paint/index.html" title="draught::paint mod">paint</a></td><td class="docblock-short"><p>Components for painting board states onto HTML canvases</p>
</td></tr><tr class="module-item"><td><a class="mod" href="utils/index.html" title="draught::utils mod">utils</a></td><td class="docblock-short"></td></tr></table><h2 id="macros" class="section-header"><a href="#macros">Macros</a></h2>
<table><tr class="module-item"><td><a class="macro" href="macro.log.html" title="draught::log macro">log</a></td><td class="docblock-short"><p>Wrap the <a href="https://docs.rs/web-sys/0.3/web_sys/index.html" title="web_sys"><code>web_sys</code></a> access to the browser console in a macro for easy logging</p>
</td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
</td></tr><tr class="module-item"><td><a class="macro" href="macro.log_error.html" title="draught::log_error macro">log_error</a></td><td class="docblock-short"></td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
<table><tr class="module-item"><td><a class="fn" href="fn.__wasm_bindgen_generated_init_wasm.html" title="draught::__wasm_bindgen_generated_init_wasm fn">__wasm_bindgen_generated_init_wasm</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="fn" href="fn.init_wasm.html" title="draught::init_wasm fn">init_wasm</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>
<script src="../main.js"></script></body></html>

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=macro.log_error.html">
</head>
<body>
<p>Redirecting to <a href="macro.log_error.html">macro.log_error.html</a>...</p>
<script>location.replace("macro.log_error.html" + location.search + location.hash);</script>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!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="API documentation for the Rust `log_error` macro in crate `draught`."><meta name="keywords" content="rust, rustlang, rust-lang, log_error"><title>log_error in draught - 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 macro"><!--[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></p><div id="sidebar-vars" data-name="log_error" data-ty="macro" 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">Macro <a href="index.html">draught</a>::<wbr><a class="macro" href="">log_error</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/lib.rs.html#33-37" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><div class="example-wrap"><pre class="rust macro">
<span class="macro">macro_rules!</span> <span class="ident">log_error</span> {
( $( <span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span>:<span class="ident">tt</span> )<span class="op">*</span> ) <span class="op">=</span><span class="op">&gt;</span> { ... };
}</pre></div>
</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 when outlining black squares"><meta name="keywords" content="rust, rustlang, rust-lang, OUTLINE_WIDTH"><title>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">
<!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 when outlining black squares as proportion of min cell dimension"><meta name="keywords" content="rust, rustlang, rust-lang, OUTLINE_WIDTH"><title>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="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="">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#27" title="goto source code">[src]</a></span></h1><pre class="rust const">const 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 when outlining black squares</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="">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#27" title="goto source code">[src]</a></span></h1><pre class="rust const">const OUTLINE_WIDTH: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 0.05;</pre><div class="docblock"><p>Line width when outlining black squares as proportion of min cell dimension</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 +0,0 @@
<!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#52" 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> = 14.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

@ -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="Line width for outlining pieces as proportion of piece radius"><meta name="keywords" content="rust, rustlang, rust-lang, PIECE_OUTLINE_PROPORTION"><title>PIECE_OUTLINE_PROPORTION 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_PROPORTION" 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_PROPORTION</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_PROPORTION: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 0.25;</pre><div class="docblock"><p>Line width for outlining pieces as proportion of 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 +0,0 @@
<!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#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> = 6.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="Proportion of square that piece fills as proportion of min cell dimension"><meta name="keywords" content="rust, rustlang, rust-lang, PIECE_PROPORTION"><title>PIECE_PROPORTION 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_PROPORTION" 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_PROPORTION</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#52" title="goto source code">[src]</a></span></h1><pre class="rust const">const PIECE_PROPORTION: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f64.html">f64</a> = 0.6;</pre><div class="docblock"><p>Proportion of square that piece fills as proportion of min cell dimension</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-384" 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-391" 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>
@ -11,9 +11,9 @@
</td></tr><tr class="module-item"><td><a class="constant" href="constant.DRAW_OUTLINE.html" title="draught::paint::DRAW_OUTLINE constant">DRAW_OUTLINE</a></td><td class="docblock-short"><p>Whether to outline black squares</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.DRAW_PIECE_OUTLINES.html" title="draught::paint::DRAW_PIECE_OUTLINES constant">DRAW_PIECE_OUTLINES</a></td><td class="docblock-short"><p>Whether to outline pieces</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.KING_OUTLINE.html" title="draught::paint::KING_OUTLINE constant">KING_OUTLINE</a></td><td class="docblock-short"><p>Default hex colour value for black piece outline</p>
</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.OUTLINE_WIDTH.html" title="draught::paint::OUTLINE_WIDTH constant">OUTLINE_WIDTH</a></td><td class="docblock-short"><p>Line width when outlining black squares as proportion of min cell dimension</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.PIECE_OUTLINE_PROPORTION.html" title="draught::paint::PIECE_OUTLINE_PROPORTION constant">PIECE_OUTLINE_PROPORTION</a></td><td class="docblock-short"><p>Line width for outlining pieces as proportion of piece radius</p>
</td></tr><tr class="module-item"><td><a class="constant" href="constant.PIECE_PROPORTION.html" title="draught::paint::PIECE_PROPORTION constant">PIECE_PROPORTION</a></td><td class="docblock-short"><p>Proportion of square that piece fills as proportion of min cell dimension</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>

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"],["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"]]});
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 as proportion of min cell dimension"],["PIECE_OUTLINE_PROPORTION","Line width for outlining pieces as proportion of piece radius"],["PIECE_PROPORTION","Proportion of square that piece fills as proportion of min cell dimension"],["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

View File

@ -1 +1 @@
initSidebarItems({"fn":[["__wasm_bindgen_generated_init_wasm",""],["init_wasm",""]],"macro":[["log","Wrap the [`web_sys`] access to the browser console in a macro for easy logging"]],"mod":[["board","Board module for components related to the checkers board and game structure"],["comp","AI player logic"],["game","Top-level object for managing [`Board`]s, applying and managing turns"],["paint","Components for painting board states onto HTML canvases"],["utils",""]]});
initSidebarItems({"fn":[["__wasm_bindgen_generated_init_wasm",""],["init_wasm",""]],"macro":[["log","Wrap the [`web_sys`] access to the browser console in a macro for easy logging"],["log_error",""]],"mod":[["board","Board module for components related to the checkers board and game structure"],["comp","AI player logic"],["game","Top-level object for managing [`Board`]s, applying and managing turns"],["paint","Components for painting board states onto HTML canvases"],["utils",""]]});

File diff suppressed because one or more lines are too long

View File

@ -382,16 +382,63 @@
<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>
<span id="386">386</span>
<span id="387">387</span>
<span id="388">388</span>
<span id="389">389</span>
<span id="390">390</span>
<span id="391">391</span>
<span id="392">392</span>
<span id="393">393</span>
<span id="394">394</span>
<span id="395">395</span>
<span id="396">396</span>
<span id="397">397</span>
<span id="398">398</span>
<span id="399">399</span>
<span id="400">400</span>
<span id="401">401</span>
<span id="402">402</span>
<span id="403">403</span>
<span id="404">404</span>
<span id="405">405</span>
<span id="406">406</span>
<span id="407">407</span>
<span id="408">408</span>
<span id="409">409</span>
<span id="410">410</span>
<span id="411">411</span>
<span id="412">412</span>
<span id="413">413</span>
<span id="414">414</span>
<span id="415">415</span>
<span id="416">416</span>
<span id="417">417</span>
<span id="418">418</span>
<span id="419">419</span>
<span id="420">420</span>
<span id="421">421</span>
<span id="422">422</span>
<span id="423">423</span>
<span id="424">424</span>
<span id="425">425</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! AI player logic</span>
<span class="kw">use</span> <span class="ident">indextree</span>::{<span class="ident">Arena</span>, <span class="ident">Node</span>, <span class="ident">NodeId</span>, <span class="ident">NodeEdge</span>};
<span class="kw">use</span> <span class="ident">rand::prelude</span>::<span class="kw-2">*</span>;
<span class="kw">use</span> <span class="ident">rand::seq::SliceRandom</span>;
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">wasm_bindgen</span>;
<span class="comment">// use wasm_bindgen::prelude::*;</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">::log_error</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::enums</span>::{<span class="ident">MoveType</span>, <span class="ident">Moveable</span>, <span class="ident">Team</span>};
@ -448,13 +495,15 @@
<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>,
<span class="kw">pub</span> <span class="ident">last_node_count</span>: <span class="ident">usize</span>,
<span class="kw">pub</span> <span class="ident">perfect_chance</span>: <span class="ident">f64</span>,
}
<span class="kw">impl</span> <span class="ident">Computer</span> {
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">search_depth</span>: <span class="ident">usize</span>, <span class="ident">team</span>: <span class="ident">Team</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Computer</span> {
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">search_depth</span>: <span class="ident">usize</span>, <span class="ident">team</span>: <span class="ident">Team</span>, <span class="ident">perfect_chance</span>: <span class="ident">f64</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Computer</span> {
<span class="ident">Computer</span> {
<span class="ident">search_depth</span>,
<span class="ident">team</span>,
<span class="ident">perfect_chance</span>,
<span class="ident">last_node_count</span>: <span class="number">0</span>,
}
}
@ -718,51 +767,90 @@
.<span class="ident">expect</span>(<span class="string">&quot;No node returned for node id&quot;</span>)
.<span class="ident">get</span>(); <span class="comment">// get BoardNode from Node</span>
<span class="comment">// when boards have equal scores, store for shuffling and selection</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">equal_scores</span> <span class="op">=</span> <span class="ident">Vec::with_capacity</span>(<span class="number">10</span>);
<span class="comment">// node ids of available next moves</span>
<span class="kw">let</span> <span class="ident">possible_moves</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">NodeId</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">root_node</span>.<span class="ident">children</span>(<span class="kw-2">&amp;</span><span class="ident">tree</span>).<span class="ident">collect</span>();
<span class="kw">if</span> <span class="ident">possible_moves</span>.<span class="ident">len</span>() <span class="op">=</span><span class="op">=</span> <span class="number">0</span> {
<span class="kw">return</span> <span class="prelude-val">None</span>;
}
<span class="comment">// DEBUG</span>
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">feature</span> <span class="op">=</span> <span class="string">&quot;debug_logs&quot;</span>)]</span>
{
<span class="macro">log!</span>(<span class="string">&quot;Current root score: {}&quot;</span>, <span class="ident">root_board_node</span>.<span class="ident">score</span>);
<span class="kw">let</span> <span class="ident">scores</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">NodeId</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">root_node</span>
.<span class="ident">children</span>(<span class="kw-2">&amp;</span><span class="ident">tree</span>)
.<span class="ident">collect</span>();
<span class="kw">let</span> <span class="ident">scores</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">isize</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">scores</span>
.<span class="ident">into_iter</span>()
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">tree</span>.<span class="ident">get</span>(<span class="ident">n</span>).<span class="ident">unwrap</span>().<span class="ident">get</span>().<span class="ident">score</span>)
<span class="kw">let</span> <span class="ident">scores</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">isize</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">possible_moves</span>
.<span class="ident">iter</span>()
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">tree</span>.<span class="ident">get</span>(<span class="kw-2">*</span><span class="ident">n</span>).<span class="ident">unwrap</span>().<span class="ident">get</span>().<span class="ident">score</span>)
.<span class="ident">collect</span>();
<span class="macro">log!</span>(<span class="string">&quot;Next boards scores: {:?}&quot;</span>, <span class="ident">scores</span>);
}
<span class="comment">// search through root node&#39;s children for the same score</span>
<span class="kw">for</span> <span class="ident">n</span> <span class="kw">in</span> <span class="ident">root_node</span>.<span class="ident">children</span>(<span class="kw-2">&amp;</span><span class="ident">tree</span>) {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">rng</span> <span class="op">=</span> <span class="ident">rand::thread_rng</span>();
<span class="comment">// random number to compare against threshold</span>
<span class="kw">let</span> <span class="ident">perfect_num</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="ident">rng</span>.<span class="ident">gen</span>();
<span class="comment">// get each board</span>
<span class="kw">let</span> <span class="ident">iter_board_node</span> <span class="op">=</span> <span class="ident">tree</span>
.<span class="ident">get</span>(<span class="ident">n</span>) <span class="comment">// get Node</span>
.<span class="ident">expect</span>(<span class="string">&quot;No node returned for node id&quot;</span>)
.<span class="ident">get</span>(); <span class="comment">// get BoardNode from Node</span>
<span class="comment">// make perfect move</span>
<span class="kw">if</span> <span class="ident">perfect_num</span> <span class="op">&lt;</span> <span class="self">self</span>.<span class="ident">perfect_chance</span> {
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">feature</span> <span class="op">=</span> <span class="string">&quot;debug_logs&quot;</span>)]</span>
<span class="macro">log!</span>(<span class="string">&quot;Making perfect move&quot;</span>);
<span class="kw">if</span> <span class="ident">root_board_node</span>.<span class="ident">score</span> <span class="op">=</span><span class="op">=</span> <span class="ident">iter_board_node</span>.<span class="ident">score</span> {
<span class="ident">equal_scores</span>.<span class="ident">push</span>(<span class="ident">iter_board_node</span>);
<span class="comment">// return Some(iter_board_node.board.clone());</span>
<span class="comment">// get boards of equal score that are perfect for the given player</span>
<span class="kw">let</span> <span class="ident">possible_perfect_moves</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw-2">&amp;</span><span class="ident">BoardNode</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">possible_moves</span>
.<span class="ident">iter</span>()
.<span class="ident">map</span>(
<span class="comment">// get immutable references to BoardNodes for possible moves</span>
<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">tree</span>
.<span class="ident">get</span>(<span class="kw-2">*</span><span class="ident">n</span>) <span class="comment">// get Node using NodeID</span>
.<span class="ident">expect</span>(<span class="string">&quot;Unable to get perfect move data from tree node&quot;</span>)
.<span class="ident">get</span>() <span class="comment">// get *BoardNode from Node</span>
)
.<span class="ident">filter</span>(
<span class="comment">// filter for only scores of root node which are perfect moves</span>
<span class="op">|</span><span class="ident">b</span><span class="op">|</span> <span class="ident">b</span>.<span class="ident">score</span> <span class="op">=</span><span class="op">=</span> <span class="ident">root_board_node</span>.<span class="ident">score</span>
)
.<span class="ident">collect</span>();
<span class="comment">// weird error, no child nodes have same score as root node</span>
<span class="comment">// this is odd because the root nodes score is either the max or min of it&#39;s children</span>
<span class="kw">if</span> <span class="ident">possible_perfect_moves</span>.<span class="ident">len</span>() <span class="op">=</span><span class="op">=</span> <span class="number">0</span> {
<span class="macro">log_error!</span>(<span class="string">&quot;No next moves matched the score of the root node, picking randomly instead&quot;</span>);
<span class="prelude-val">Some</span>(<span class="ident">Computer::random_choice</span>(<span class="kw-2">&amp;</span><span class="ident">tree</span>, <span class="ident">possible_moves</span>, <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">rng</span>))
}
<span class="comment">// only one possible move, use that</span>
<span class="kw">else</span> <span class="kw">if</span> <span class="ident">possible_perfect_moves</span>.<span class="ident">len</span>() <span class="op">=</span><span class="op">=</span> <span class="number">1</span> {
<span class="prelude-val">Some</span>(<span class="ident">possible_perfect_moves</span>[<span class="number">0</span>].<span class="ident">board</span>.<span class="ident">clone</span>())
}
<span class="comment">// more than one possible perfect move to make, choose one randomly</span>
<span class="kw">else</span> {
<span class="prelude-val">Some</span>(
<span class="ident">possible_perfect_moves</span>
.<span class="ident">choose</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">rng</span>) <span class="comment">// random choice</span>
.<span class="ident">unwrap</span>() <span class="comment">// unwrap Option</span>
.<span class="ident">board</span>
.<span class="ident">clone</span>()
)
}
}
<span class="comment">// get random move</span>
<span class="kw">else</span> {
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">feature</span> <span class="op">=</span> <span class="string">&quot;debug_logs&quot;</span>)]</span>
<span class="macro">log!</span>(<span class="string">&quot;Making random move&quot;</span>);
<span class="kw">if</span> <span class="ident">equal_scores</span>.<span class="ident">len</span>() <span class="op">=</span><span class="op">=</span> <span class="number">0</span> {
<span class="prelude-val">None</span>
} <span class="kw">else</span> <span class="kw">if</span> <span class="ident">equal_scores</span>.<span class="ident">len</span>() <span class="op">=</span><span class="op">=</span> <span class="number">1</span> {
<span class="prelude-val">Some</span>(<span class="ident">equal_scores</span>[<span class="number">0</span>].<span class="ident">board</span>.<span class="ident">clone</span>())
} <span class="kw">else</span> {
<span class="prelude-val">Some</span>(<span class="ident">equal_scores</span>
.<span class="ident">choose</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">rand::thread_rng</span>())
.<span class="ident">unwrap</span>()
.<span class="ident">board</span>
.<span class="ident">clone</span>()
)
<span class="prelude-val">Some</span>(<span class="ident">Computer::random_choice</span>(<span class="kw-2">&amp;</span><span class="ident">tree</span>, <span class="ident">possible_moves</span>, <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">rng</span>))
}
}
<span class="doccomment">/// Get a random board from possible node IDs and associated tree</span>
<span class="kw">fn</span> <span class="ident">random_choice</span>(<span class="ident">tree</span>: <span class="kw-2">&amp;</span><span class="ident">Arena</span><span class="op">&lt;</span><span class="ident">BoardNode</span><span class="op">&gt;</span>, <span class="ident">possible_moves</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">NodeId</span><span class="op">&gt;</span>, <span class="ident">rng</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">ThreadRng</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Board</span> {
<span class="kw">let</span> <span class="ident">chosen_move</span> <span class="op">=</span> <span class="ident">possible_moves</span>.<span class="ident">choose</span>(<span class="ident">rng</span>).<span class="ident">unwrap</span>();
<span class="ident">tree</span>
.<span class="ident">get</span>(<span class="kw-2">*</span><span class="ident">chosen_move</span>)
.<span class="ident">expect</span>(<span class="string">&quot;Unable to get random move data from tree node&quot;</span>)
.<span class="ident">get</span>()
.<span class="ident">board</span>
.<span class="ident">clone</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>
<script src="../../../main.js"></script><script src="../../../source-script.js"></script><script src="../../../source-files.js"></script></body></html>

View File

@ -235,6 +235,23 @@
<span id="232">232</span>
<span id="233">233</span>
<span id="234">234</span>
<span id="235">235</span>
<span id="236">236</span>
<span id="237">237</span>
<span id="238">238</span>
<span id="239">239</span>
<span id="240">240</span>
<span id="241">241</span>
<span id="242">242</span>
<span id="243">243</span>
<span id="244">244</span>
<span id="245">245</span>
<span id="246">246</span>
<span id="247">247</span>
<span id="248">248</span>
<span id="249">249</span>
<span id="250">250</span>
<span id="251">251</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Top-level object for managing [`Board`]s, applying and managing turns</span>
@ -267,6 +284,7 @@
<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>,
<span class="ident">search_depth</span>: <span class="ident">usize</span>,
<span class="kw">pub</span> <span class="ident">last_node_count</span>: <span class="ident">usize</span>,
<span class="kw">pub</span> <span class="ident">perfect_chance</span>: <span class="ident">f64</span>,
}
<span class="kw">impl</span> <span class="ident">Game</span> {
@ -333,6 +351,7 @@
<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 tree depth for AI to search to</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">set_search_depth</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">search_depth</span>: <span class="ident">usize</span>) {
<span class="self">self</span>.<span class="ident">search_depth</span> <span class="op">=</span> <span class="ident">search_depth</span>;
}
@ -352,6 +371,11 @@
}
}
<span class="doccomment">/// Set proportion of perfect moves from AI</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">set_perfect_chance</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">new_chance</span>: <span class="ident">f64</span>) {
<span class="self">self</span>.<span class="ident">perfect_chance</span> <span class="op">=</span> <span class="ident">new_chance</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>;
@ -418,6 +442,7 @@
<span class="ident">painter</span>: <span class="prelude-val">None</span>,
<span class="ident">search_depth</span>,
<span class="ident">last_node_count</span>: <span class="number">0</span>,
<span class="ident">perfect_chance</span>: <span class="number">0.5</span>,
}
}
@ -434,6 +459,7 @@
),
<span class="ident">search_depth</span>,
<span class="ident">last_node_count</span>: <span class="number">0</span>,
<span class="ident">perfect_chance</span>: <span class="number">0.5</span>,
}
}
@ -453,14 +479,22 @@
<span class="doccomment">/// Create computer, get move from current board and update current board</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">ai_move</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="self">self</span>) {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">comp</span> <span class="op">=</span> <span class="ident">Computer::new</span>(<span class="self">self</span>.<span class="ident">search_depth</span>, <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">comp</span> <span class="op">=</span> <span class="ident">Computer::new</span>(<span class="self">self</span>.<span class="ident">search_depth</span>, <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>, <span class="self">self</span>.<span class="ident">perfect_chance</span>);
<span class="kw">let</span> <span class="ident">new_brd</span> <span class="op">=</span> <span class="ident">comp</span>.<span class="ident">get_move</span>(<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">clone</span>());
<span class="self">self</span>.<span class="ident">last_node_count</span> <span class="op">=</span> <span class="ident">comp</span>.<span class="ident">last_node_count</span>;
<span class="kw">match</span> <span class="ident">new_brd</span> {
<span class="prelude-val">Some</span>(<span class="ident">brd</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="self">self</span>.<span class="ident">push_new_board</span>(<span class="ident">brd</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 AI move returned&quot;</span>),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="macro">log!</span>(<span class="string">&quot;No possible moves, re-pushing current board&quot;</span>);
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">new_brd</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">clone</span>();
<span class="ident">new_brd</span>.<span class="ident">current_turn</span> <span class="op">=</span> <span class="ident">new_brd</span>.<span class="ident">current_turn</span>.<span class="ident">opponent</span>();
<span class="self">self</span>.<span class="ident">push_new_board</span>(<span class="ident">new_brd</span>);
},
}
}
}

View File

@ -38,6 +38,12 @@
<span id="35">35</span>
<span id="36">36</span>
<span id="37">37</span>
<span id="38">38</span>
<span id="39">39</span>
<span id="40">40</span>
<span id="41">41</span>
<span id="42">42</span>
<span id="43">43</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Draught</span>
<span class="doccomment">//! </span>
@ -70,6 +76,12 @@
<span class="ident">web_sys::console::log_1</span>(<span class="kw-2">&amp;</span><span class="macro">format!</span>( $( <span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span> )<span class="op">*</span> ).<span class="ident">into</span>());
}
}
<span class="attribute">#[<span class="ident">macro_export</span>]</span>
<span class="macro">macro_rules!</span> <span class="ident">log_error</span> {
( $( <span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span>:<span class="ident">tt</span> )<span class="op">*</span> ) <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">web_sys::console::error_1</span>(<span class="kw-2">&amp;</span><span class="macro">format!</span>( $( <span class="macro-nonterminal">$</span><span class="macro-nonterminal">t</span> )<span class="op">*</span> ).<span class="ident">into</span>());
}
}
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">init_wasm</span>() {

View File

@ -385,6 +385,13 @@
<span id="382">382</span>
<span id="383">383</span>
<span id="384">384</span>
<span id="385">385</span>
<span id="386">386</span>
<span id="387">387</span>
<span id="388">388</span>
<span id="389">389</span>
<span id="390">390</span>
<span id="391">391</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! Components for painting board states onto HTML canvases</span>
@ -411,8 +418,8 @@
<span class="doccomment">/// Default hex colour value for outline of black squares</span>
<span class="kw">const</span> <span class="ident">SQUARE_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">/// Line width when outlining black squares</span>
<span class="kw">const</span> <span class="ident">OUTLINE_WIDTH</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">3.0</span>;
<span class="doccomment">/// Line width when outlining black squares as proportion of min cell dimension</span>
<span class="kw">const</span> <span class="ident">OUTLINE_WIDTH</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">0.05</span>;
<span class="doccomment">/// Whether to outline black squares</span>
<span class="kw">const</span> <span class="ident">DRAW_OUTLINE</span>: <span class="ident">bool</span> <span class="op">=</span> <span class="bool-val">true</span>;
@ -434,10 +441,10 @@
<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>
<span class="kw">const</span> <span class="ident">DRAW_PIECE_OUTLINES</span>: <span class="ident">bool</span> <span class="op">=</span> <span class="bool-val">true</span>;
<span class="doccomment">/// Line width for outlining pieces</span>
<span class="kw">const</span> <span class="ident">PIECE_OUTLINE_WIDTH</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">6.0</span>;
<span class="doccomment">/// Margin from square to define piece radius</span>
<span class="kw">const</span> <span class="ident">PIECE_MARGIN</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">14.0</span>;
<span class="doccomment">/// Line width for outlining pieces as proportion of piece radius</span>
<span class="kw">const</span> <span class="ident">PIECE_OUTLINE_PROPORTION</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">0.25</span>;
<span class="doccomment">/// Proportion of square that piece fills as proportion of min cell dimension</span>
<span class="kw">const</span> <span class="ident">PIECE_PROPORTION</span>: <span class="ident">f64</span> <span class="op">=</span> <span class="number">0.6</span>;
<span class="doccomment">/// Used to paint boards onto HTML canvases</span>
<span class="attribute">#[<span class="ident">wasm_bindgen</span>]</span>
@ -460,7 +467,7 @@
<span class="ident">king_line</span>: <span class="ident">JsValue</span>,
<span class="ident">piece_lines</span>: <span class="ident">bool</span>,
<span class="ident">piece_line_width</span>: <span class="ident">f64</span>,
<span class="ident">piece_line_proportion</span>: <span class="ident">f64</span>,
<span class="ident">square_outline</span>: <span class="ident">JsValue</span>,
<span class="ident">outline_width</span>: <span class="ident">f64</span>,
@ -556,7 +563,7 @@
<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>,
<span class="ident">piece_line_proportion</span>: <span class="ident">PIECE_OUTLINE_PROPORTION</span>,
<span class="ident">square_outline</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SQUARE_OUTLINE</span>),
<span class="ident">outline_width</span>: <span class="ident">OUTLINE_WIDTH</span>,
@ -589,7 +596,7 @@
<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>,
<span class="ident">piece_line_proportion</span>: <span class="ident">PIECE_OUTLINE_PROPORTION</span>,
<span class="ident">square_outline</span>: <span class="ident">JsValue::from_str</span>(<span class="ident">SQUARE_OUTLINE</span>),
<span class="ident">outline_width</span>: <span class="ident">OUTLINE_WIDTH</span>,
@ -643,12 +650,19 @@
<span class="kw">let</span> <span class="ident">cell_height</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">height</span> <span class="kw">as</span> <span class="ident">usize</span> <span class="op">/</span> <span class="ident">board</span>.<span class="ident">height</span>;
<span class="kw">let</span> <span class="ident">cell_width</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">width</span> <span class="kw">as</span> <span class="ident">usize</span> <span class="op">/</span> <span class="ident">board</span>.<span class="ident">width</span>;
<span class="kw">let</span> <span class="ident">min_dimension</span> <span class="op">=</span> <span class="ident">usize::min</span>(<span class="ident">cell_width</span>, <span class="ident">cell_height</span>) <span class="kw">as</span> <span class="ident">f64</span>;
<span class="kw">let</span> <span class="ident">cell_radius</span> <span class="op">=</span> <span class="ident">min_dimension</span> <span class="op">*</span> <span class="ident">PIECE_PROPORTION</span> <span class="op">/</span> <span class="number">2.0</span>;
<span class="kw">let</span> <span class="ident">piece_outline</span> <span class="op">=</span> <span class="ident">cell_radius</span> <span class="op">*</span> <span class="self">self</span>.<span class="ident">piece_line_proportion</span>;
<span class="kw">let</span> <span class="ident">square_outline</span> <span class="op">=</span> <span class="ident">min_dimension</span> <span class="op">*</span> <span class="self">self</span>.<span class="ident">outline_width</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">white_square</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">fill_rect</span>(<span class="number">0.0</span>, <span class="number">0.0</span>, <span class="self">self</span>.<span class="ident">width</span> <span class="kw">as</span> <span class="ident">f64</span>, <span class="self">self</span>.<span class="ident">height</span> <span class="kw">as</span> <span class="ident">f64</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">black_square</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">square_outline</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">outline_width</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">set_line_width</span>(<span class="ident">square_outline</span>);
<span class="comment">// Draw black squares onto canvas</span>
<span class="kw">for</span> <span class="ident">i</span> <span class="kw">in</span> <span class="number">0</span>..<span class="ident">board</span>.<span class="ident">height</span> {
@ -724,7 +738,7 @@
<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="ident">cell_radius</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>
{
@ -734,7 +748,7 @@
<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">set_line_width</span>(<span class="ident">piece_outline</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">stroke</span>()
}
@ -754,7 +768,7 @@
<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="ident">cell_radius</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>
{
@ -764,7 +778,7 @@
<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">set_line_width</span>(<span class="ident">piece_outline</span>);
<span class="self">self</span>.<span class="ident">context</span>.<span class="ident">stroke</span>()
}
}

View File

@ -119,7 +119,7 @@
</div>
</div>
<div class="row p-3">
<div class="col-sm-4" title="should the AI play?">
<div class="col-sm-3" title="should the AI play?">
<input class="form-check-input"
type="checkbox"
value=""
@ -129,15 +129,19 @@
AI Player
</label>
</div>
<div class="col-sm-4" title="how many layers deep should the AI search (grows exponentially, be careful)">
<div class="col-sm-3" title="how many layers deep should the AI search (grows exponentially, be careful)">
<input type="number"
id="ai_search_depth"
name="ai_search_depth"
min="1" max="10" value="4"
class="form-control">
<label for="ai_search_depth">ai difficulty <small class="text-muted">moves ahead</small></label>
<label for="ai_search_depth">ai clairvoyance <small class="text-muted">moves ahead</small></label>
</div>
<div class="col-sm-4" title="how many nodes were expanded in the search tree">
<div class="col-sm-3" title="what percentage of the AI's moves should be perfect?">
<label for="ai_difficulty" class="form-label">ai difficulty <small class="text-muted">%</small></label>
<input type="range" class="form-range" min="1" max="100" id="ai_difficulty">
</div>
<div class="col-sm-3" title="how many nodes were expanded in the search tree">
<p class="text-muted" id="node-count"></p>
</div>
</div>