deploy: 13a17d538b
This commit is contained in:
parent
820fb0f690
commit
55a29fbd6f
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.
@ -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">
|
<!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-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">☰</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>
|
<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">☰</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">−</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#1-149" 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">−</span>]</a></span><a class="srclink" href="../../src/draught/game/mod.rs.html#1-150" title="goto source code">[src]</a></span></h1><div class="docblock"><p>Top-level object for managing <a href="../board/struct.Board.html" title="Board"><code>Board</code></a>s, applying and managing turns</p>
|
||||||
</div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
</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>
|
<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>
|
</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>
|
||||||
|
@ -9,16 +9,16 @@
|
|||||||
</div><h2 id="fields" class="fields small-section-header">
|
</div><h2 id="fields" class="fields small-section-header">
|
||||||
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.current" class="structfield small-section-header"><a href="#structfield.current" class="anchor field"></a><code>current: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.previous_boards" class="structfield small-section-header"><a href="#structfield.previous_boards" class="anchor field"></a><code>previous_boards: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>></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><<a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</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#30-40" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.previous_board" class="method"><code>pub fn <a href="#method.previous_board" class="fnname">previous_board</a>(&self, turn: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> &<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.previous_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#32-34" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a read-only copy of a previous turn’s board</p>
|
Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.current" class="structfield small-section-header"><a href="#structfield.current" class="anchor field"></a><code>current: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code></span><span id="structfield.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><<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>></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><<a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</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#30-40" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.previous_board" class="method"><code>pub fn <a href="#method.previous_board" class="fnname">previous_board</a>(&self, turn: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>) -> &<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.previous_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#32-34" title="goto source code">[src]</a></h4><div class="docblock"><p>Get a read-only copy of a previous turn’s board</p>
|
||||||
</div><h4 id="method.current_board" class="method"><code>pub fn <a href="#method.current_board" class="fnname">current_board</a>(&self) -> &<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.current_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#37-39" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
|
</div><h4 id="method.current_board" class="method"><code>pub fn <a href="#method.current_board" class="fnname">current_board</a>(&self) -> &<a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a></code><a href="#method.current_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#37-39" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
|
||||||
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-1" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#43-143" 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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_board_cells" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#45-47" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current board’s squares</p>
|
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-1" class="impl"><code class="in-band">impl <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#43-144" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.current_board_cells" class="method"><code>pub fn <a href="#method.current_board_cells" class="fnname">current_board_cells</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html">*const </a><a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_board_cells" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#45-47" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current board’s 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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a href="#method.current_board_len" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#50-52" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current board’s 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>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a></code><a href="#method.current_board_len" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#50-52" title="goto source code">[src]</a></h4><div class="docblock"><p>Get pointer to current board’s squares</p>
|
||||||
</div><h4 id="method.current_turn" class="method"><code>pub fn <a href="#method.current_turn" class="fnname">current_turn</a>(&self) -> <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code><a href="#method.current_turn" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#55-57" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turn’s team</p>
|
</div><h4 id="method.current_turn" class="method"><code>pub fn <a href="#method.current_turn" class="fnname">current_turn</a>(&self) -> <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a></code><a href="#method.current_turn" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#55-57" title="goto source code">[src]</a></h4><div class="docblock"><p>Current turn’s team</p>
|
||||||
</div><h4 id="method.current_cell_state" class="method"><code>pub fn <a href="#method.current_cell_state" class="fnname">current_cell_state</a>(&self, idx: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -> <a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_cell_state" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#59-61" title="goto source code">[src]</a></h4><h4 id="method.make_move" class="method"><code>pub fn <a href="#method.make_move" class="fnname">make_move</a>(&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>) -> <a class="enum" href="../board/enums/enum.Moveable.html" title="enum draught::board::enums::Moveable">Moveable</a></code><a href="#method.make_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#64-85" 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.current_cell_state" class="method"><code>pub fn <a href="#method.current_cell_state" class="fnname">current_cell_state</a>(&self, idx: &<a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>) -> <a class="struct" href="../board/struct.Square.html" title="struct draught::board::Square">Square</a></code><a href="#method.current_cell_state" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#59-61" title="goto source code">[src]</a></h4><h4 id="method.make_move" class="method"><code>pub fn <a href="#method.make_move" class="fnname">make_move</a>(&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>) -> <a class="enum" href="../board/enums/enum.Moveable.html" title="enum draught::board::enums::Moveable">Moveable</a></code><a href="#method.make_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#64-86" title="goto source code">[src]</a></h4><div class="docblock"><p>Attempt to make a move given a source and destination index</p>
|
||||||
</div><h4 id="method.execute_move" class="method"><code>pub fn <a href="#method.execute_move" class="fnname">execute_move</a>(&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#88-91" 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_move" class="method"><code>pub fn <a href="#method.execute_move" class="fnname">execute_move</a>(&mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_move" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#89-92" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given move and push new board into current state</p>
|
||||||
</div><h4 id="method.execute_jump" class="method"><code>pub fn <a href="#method.execute_jump" class="fnname">execute_jump</a>(&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#94-97" 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.execute_jump" class="method"><code>pub fn <a href="#method.execute_jump" class="fnname">execute_jump</a>(&mut self, from: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>, to: <a class="struct" href="../board/struct.BrdIdx.html" title="struct draught::board::BrdIdx">BrdIdx</a>)</code><a href="#method.execute_jump" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#95-98" title="goto source code">[src]</a></h4><div class="docblock"><p>Update board state with given jump move and push new board into current state</p>
|
||||||
</div><h4 id="method.push_new_board" class="method"><code>pub fn <a href="#method.push_new_board" class="fnname">push_new_board</a>(&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#100-103" 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.push_new_board" class="method"><code>pub fn <a href="#method.push_new_board" class="fnname">push_new_board</a>(&mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.push_new_board" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#101-104" title="goto source code">[src]</a></h4><div class="docblock"><p>Push current board into the previous turns and set given board to current</p>
|
||||||
</div><h4 id="method.set_current" class="method"><code>pub fn <a href="#method.set_current" class="fnname">set_current</a>(&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#106-108" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
|
</div><h4 id="method.set_current" class="method"><code>pub fn <a href="#method.set_current" class="fnname">set_current</a>(&mut self, board: <a class="struct" href="../board/struct.Board.html" title="struct draught::board::Board">Board</a>)</code><a href="#method.set_current" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#107-109" title="goto source code">[src]</a></h4><div class="docblock"><p>Set current board to given</p>
|
||||||
</div><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(<br> width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a><br>) -> <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#111-119" title="goto source code">[src]</a></h4><h4 id="method.new_with_canvas" class="method"><code>pub fn <a href="#method.new_with_canvas" class="fnname">new_with_canvas</a>(<br> width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>, <br> canvas_id: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> canvas_width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br> canvas_height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -> <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#121-131" title="goto source code">[src]</a></h4><h4 id="method.set_painter" class="method"><code>pub fn <a href="#method.set_painter" class="fnname">set_painter</a>(&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#133-135" title="goto source code">[src]</a></h4><h4 id="method.draw" class="method"><code>pub fn <a href="#method.draw" class="fnname">draw</a>(&self)</code><a href="#method.draw" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#137-142" title="goto source code">[src]</a></h4></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
</div><h4 id="method.new" class="method"><code>pub fn <a href="#method.new" class="fnname">new</a>(<br> width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a><br>) -> <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#112-120" title="goto source code">[src]</a></h4><h4 id="method.new_with_canvas" class="method"><code>pub fn <a href="#method.new_with_canvas" class="fnname">new_with_canvas</a>(<br> width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> piece_rows: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, <br> first_turn: <a class="enum" href="../board/enums/enum.Team.html" title="enum draught::board::enums::Team">Team</a>, <br> canvas_id: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> canvas_width: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br> canvas_height: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br>) -> <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#method.new_with_canvas" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#122-132" title="goto source code">[src]</a></h4><h4 id="method.set_painter" class="method"><code>pub fn <a href="#method.set_painter" class="fnname">set_painter</a>(&mut self, value: <a class="struct" href="../paint/struct.Painter.html" title="struct draught::paint::Painter">Painter</a>)</code><a href="#method.set_painter" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#134-136" title="goto source code">[src]</a></h4><h4 id="method.draw" class="method"><code>pub fn <a href="#method.draw" class="fnname">draw</a>(&self)</code><a href="#method.draw" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#138-143" title="goto source code">[src]</a></h4></div></details><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Debug" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Debug" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#23" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||||
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-Display" class="impl"><code class="in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-Display" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#145-149" 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>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <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#146-148" 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#146-150" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.fmt-1" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a href="#method.fmt-1" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#147-149" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||||
</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><<a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>> for <a class="struct" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a href="#impl-From%3CGame%3E" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.from" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(value: <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>) -> Self</code><a href="#method.from" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-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><<a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>> for <a class="struct" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/struct.JsValue.html" title="struct wasm_bindgen::JsValue">JsValue</a></code><a href="#impl-From%3CGame%3E" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="method.from" class="method hidden trait-impl"><code>fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(value: <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a>) -> Self</code><a href="#method.from" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>
|
||||||
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-FromWasmAbi" class="impl"><code class="in-band">impl <a class="trait" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::traits::FromWasmAbi">FromWasmAbi</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-FromWasmAbi" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Abi-1" class="type trait-impl"><code>type <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi" class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a href="#associatedtype.Abi-1" class="anchor"></a></h4><div class='docblock'><p>The wasm ABI type that this converts from when coming back out from the
|
</div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><h3 id="impl-FromWasmAbi" class="impl"><code class="in-band">impl <a class="trait" href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html" title="trait wasm_bindgen::convert::traits::FromWasmAbi">FromWasmAbi</a> for <a class="struct" href="struct.Game.html" title="struct draught::game::Game">Game</a></code><a href="#impl-FromWasmAbi" class="anchor"></a><a class="srclink" href="../../src/draught/game/mod.rs.html#22" title="goto source code">[src]</a></h3></summary><div class="impl-items"><h4 id="associatedtype.Abi-1" class="type trait-impl"><code>type <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi" class="type">Abi</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a></code><a href="#associatedtype.Abi-1" class="anchor"></a></h4><div class='docblock'><p>The wasm ABI type that this converts from when coming back out from the
|
||||||
ABI boundary. <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi">Read more</a></p>
|
ABI boundary. <a href="https://docs.rs/wasm-bindgen/0.2/wasm_bindgen/convert/traits/trait.FromWasmAbi.html#associatedtype.Abi">Read more</a></p>
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
<span id="147">147</span>
|
<span id="147">147</span>
|
||||||
<span id="148">148</span>
|
<span id="148">148</span>
|
||||||
<span id="149">149</span>
|
<span id="149">149</span>
|
||||||
|
<span id="150">150</span>
|
||||||
</pre><div class="example-wrap"><pre class="rust ">
|
</pre><div class="example-wrap"><pre class="rust ">
|
||||||
<span class="doccomment">//! Top-level object for managing [`Board`]s, applying and managing turns</span>
|
<span class="doccomment">//! Top-level object for managing [`Board`]s, applying and managing turns</span>
|
||||||
|
|
||||||
@ -209,8 +210,8 @@
|
|||||||
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>
|
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">current_cell_state</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">idx</span>: <span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Square</span> {
|
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">current_cell_state</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">idx</span>: <span class="kw-2">&</span><span class="ident">BrdIdx</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Square</span> {
|
||||||
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell</span>(<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell_idx</span>(<span class="ident">idx</span>))
|
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell</span>(<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">cell_idx</span>(<span class="kw-2">*</span><span class="ident">idx</span>))
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="doccomment">/// Attempt to make a move given a source and destination index</span>
|
<span class="doccomment">/// Attempt to make a move given a source and destination index</span>
|
||||||
@ -227,13 +228,14 @@
|
|||||||
<span class="kw">else</span> {
|
<span class="kw">else</span> {
|
||||||
<span class="self">self</span>.<span class="ident">execute_jump</span>(<span class="ident">from</span>, <span class="ident">to</span>);
|
<span class="self">self</span>.<span class="ident">execute_jump</span>(<span class="ident">from</span>, <span class="ident">to</span>);
|
||||||
}
|
}
|
||||||
} <span class="kw">else</span> {
|
|
||||||
<span class="macro">log!</span>(<span class="string">"Unable to make move, {:?}"</span>, <span class="ident">able</span>);
|
|
||||||
}
|
|
||||||
|
|
||||||
<span class="comment">// board has been changed, update player turn</span>
|
<span class="comment">// board has been changed, update player turn</span>
|
||||||
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>.<span class="ident">opponent</span>();
|
<span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">current</span>.<span class="ident">current_turn</span>.<span class="ident">opponent</span>();
|
||||||
|
|
||||||
|
} <span class="kw">else</span> {
|
||||||
|
<span class="macro">log!</span>(<span class="string">"Unable to make move, {:?}"</span>, <span class="ident">able</span>);
|
||||||
|
}
|
||||||
|
|
||||||
<span class="ident">able</span>
|
<span class="ident">able</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
index.html
11
index.html
@ -42,12 +42,19 @@
|
|||||||
<div class="row p-3">
|
<div class="row p-3">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<a href="doc/draught" class="btn btn-secondary">Docs</a>
|
<a href="doc/draught" class="btn btn-secondary">Docs</a>
|
||||||
|
<!-- <button id="startBtn" class="btn btn-primary">Start</button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row p-1">
|
<div class="row p-3">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-6">
|
||||||
|
<h1 id="team-p"></h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
<p hidden id="status-p"></p>
|
<p hidden id="status-p"></p>
|
||||||
|
<div hidden id="status-d" class="alert alert-danger" role="alert">
|
||||||
|
A simple success alert—check it out!
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user