diff options
| author | tslil clingman <> | 2021-10-15 21:37:43 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2021-10-15 21:37:43 -0400 |
| commit | 93bd7e3aa2d2b615018c6d118ef3bf13aa0b0ab1 (patch) | |
| tree | ebcc20d7665caa0022c255c60ce698d2b7b73d21 | |
| parent | a0f3a7f8ba9036d1fcb18941a54077082f15cf3c (diff) | |
Update dependenciesgui
| -rw-r--r-- | Cargo.toml | 6 | ||||
| -rw-r--r-- | src/consulter.rs | 24 | ||||
| -rw-r--r-- | src/game.rs | 31 | ||||
| -rw-r--r-- | src/gui/boardwidget.rs | 28 | ||||
| -rw-r--r-- | src/gui/mod.rs | 45 | ||||
| -rw-r--r-- | src/main.rs | 30 | ||||
| -rw-r--r-- | src/parser.rs | 24 | ||||
| -rw-r--r-- | src/tui.rs | 24 | ||||
| -rwxr-xr-x | wrap_taktician | 2 |
9 files changed, 109 insertions, 105 deletions
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pancurses = "0.16.1" +pancurses = "0.17.0" argparse = "0.2.2" -chrono = "0.4.10" -fltk = "^0.13" +chrono = "0.4.19" +fltk = "^1.2" #0.13 ... diff --git a/src/consulter.rs b/src/consulter.rs index 9cdbca6..d377137 100644 --- a/src/consulter.rs +++ b/src/consulter.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ use std::fs::{remove_file, File}; use std::io::{Error, ErrorKind, Result, Write}; diff --git a/src/game.rs b/src/game.rs index 7e96a2e..c0a25b8 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ use std::collections::HashSet; use std::fmt; @@ -157,9 +157,9 @@ pub type Stack = Vec<Piece>; /* const-generics would solve a lot of my consistency problems here, - GameState<const size : u8> { - ... - board: [Stack; size], +GameState<const size : u8> { +... +board: [Stack; size], } but at the time of writing this is not yet part of the language. @@ -375,6 +375,7 @@ impl GameState { - Top stone belongs to player - One or more on each subsequent square - Total number of stones picked up does not exceed the carry capacity + - Enough stones on on square - Direction does not contain a capstone - Wall may only appear on last spot if it's capstone alone that covers - All stones are used up before then end of the board is met diff --git a/src/gui/boardwidget.rs b/src/gui/boardwidget.rs index 2708f21..bbddfb4 100644 --- a/src/gui/boardwidget.rs +++ b/src/gui/boardwidget.rs @@ -1,21 +1,21 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ -use fltk::{app::*, button::*, draw::*}; +use fltk::{button::*, draw::*, enums::Color, prelude::*}; use std::rc::*; use crate::game::*; @@ -233,7 +233,7 @@ impl BoardWidget { pub fn new(button: Button, size: i32) -> BoardWidget { let renderer = Rc::new(BoardRenderer::default().with_size(size).with_org(&button)); let mut g = BoardWidget { button, renderer }; - g.button.draw2(g.generate_draw(&Vec::new())); + g.button.draw(g.generate_draw(&Vec::new())); return g; } diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 1980fdb..3c94abc 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -1,24 +1,28 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ mod boardwidget; use crate::gui::boardwidget::*; -use fltk::{app::*, button::*, menu::*, text::*, window::*}; +use fltk::{ + app::*, button::*, enums::Color, enums::FrameType, enums::Shortcut, menu::*, text::*, window::*, +}; + +use fltk::prelude::*; #[derive(Clone, Copy)] enum GUIMessage { @@ -42,13 +46,12 @@ impl GUI { // TODO: Why is this not the same as /* - let mut window = Window::default() - .with_size(800, 600) - .with_label("Takwrap") - .center_screen(); - */ + let mut window = Window::default() + .with_size(800, 600) + .with_label("Takwrap") + .center_screen(); + */ // Windows made that way are not resizable? - let mut window = DoubleWindow::new(0, 0, 800, 600, "Takwrap").center_screen(); let (sender, receiver) = channel::<GUIMessage>(); @@ -59,14 +62,14 @@ impl GUI { menu.set_color(Color::Light2); menu.add_emit( "&File/New...\t", - Shortcut::None, + Shortcut::empty(), MenuFlag::Normal, sender, GUIMessage::None, ); menu.add_emit( "&File/Open...\t", - Shortcut::None, + Shortcut::empty(), MenuFlag::Normal, sender, GUIMessage::Test, diff --git a/src/main.rs b/src/main.rs index 1d62045..c3c1839 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,15 +62,15 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["--player1"], Store, "Name of first player, defaults to $USER. See --name-white - below for Black/White assignment.", + below for Black/White assignment.", ); ap.refer(&mut p2_name).add_option( &["--player2"], Store, "Name of second player, defaults to ``Player2'' and is - overridden by the arument ENGINE of --engine when - applicable.", + overridden by the arument ENGINE of --engine when + applicable.", ); ap.refer(&mut start_type_string) @@ -78,10 +78,10 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["-v", "--variant-start"], Store, "Select the rule variant for - the start of play. Valid choices are CPSn, FCS, FES, TPS, - and CZS. The default starting type, which matches the - original rules, is CPS1. See ENGINE below for a warning on - this.", + the start of play. Valid choices are CPSn, FCS, FES, TPS, + and CZS. The default starting type, which matches the + original rules, is CPS1. See ENGINE below for a warning on + this.", ) .metavar("VRNT"); @@ -89,12 +89,12 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["-e", "--engine"], Store, "Name of process which will be used as a computer - opponent. The process must accept a single argument point - to a PTN file of the current game state, and must generate - a single PTN action on STDOUT. The engine will replace the - second player, and the name of player 2 is set to this - argument. Note: ensure that your engine understands the - [Variant XXX] directive if you choose a variant (above).", + opponent. The process must accept a single argument point + to a PTN file of the current game state, and must generate + a single PTN action on STDOUT. The engine will replace the + second player, and the name of player 2 is set to this + argument. Note: ensure that your engine understands the + [Variant XXX] directive if you choose a variant (above).", ); ap.refer(&mut name) @@ -102,7 +102,7 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the &["--name-white"], Store, "Force the player named NAME to play white. If not - supplied, assignment is ``random''.", + supplied, assignment is ``random''.", ) .metavar("NAME"); @@ -120,7 +120,7 @@ This program comes with ABSOLUTELY NO WARRANTY; and is made available under the ap.refer(&mut terminal).add_option( &["-t", "--terminal"], - Store, + StoreTrue, "Use the terminal user interface instead of the graphical one.", ); diff --git a/src/parser.rs b/src/parser.rs index 1e3ecf4..efcacfb 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ use crate::game::*; @@ -1,19 +1,19 @@ /* - This file is part of Takwrap. +This file is part of Takwrap. - Takwrap is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Takwrap is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - Takwrap is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Takwrap is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with Takwrap. If not, see <https://www.gnu.org/licenses/>. -*/ +You should have received a copy of the GNU General Public License +along with Takwrap. If not, see <https://www.gnu.org/licenses/>. + */ extern crate pancurses; diff --git a/wrap_taktician b/wrap_taktician index f667c3d..f8bfeff 100755 --- a/wrap_taktician +++ b/wrap_taktician @@ -1,3 +1,3 @@ #!/bin/bash -taktician analyze -quiet -mcts -limit 2s -depth 1 $1 | grep = | cut -d= -f2 | shuf -n 1 +taktician analyze -quiet -mcts -limit 2s -depth 2 $1 | grep = | cut -d= -f2 | shuf -n 1 |
