From 942e79bc1970b68ca1bde1cc209f738d912b394b Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 15:51:56 +0200 Subject: [PATCH 01/10] bumped version --- rs48/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs48/Cargo.toml b/rs48/Cargo.toml index 6c2b017..c5ae5c3 100644 --- a/rs48/Cargo.toml +++ b/rs48/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs48" -version = "1.2.0" +version = "1.3.0" edition = "2021" description = "A game of 2048 that plays in the terminal as a TUI with a lot of configurability." license = "GPL-3.0" From 9c253d36dfb63dafdeb39d218beaa8eb6df41b91 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 15:54:07 +0200 Subject: [PATCH 02/10] updated readme --- Cargo.lock | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- README.md | 17 ++++++-- 3 files changed, 125 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fcf3ea8..b24b115 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,6 +13,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + [[package]] name = "bitflags" version = "1.3.2" @@ -62,6 +68,55 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + [[package]] name = "getrandom" version = "0.2.7" @@ -94,6 +149,25 @@ version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "numtoa" version = "0.1.0" @@ -190,6 +264,30 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -210,31 +308,39 @@ dependencies = [ [[package]] name = "rs48" -version = "1.2.0" +version = "1.3.0" dependencies = [ "clap", "rand", - "rs48_lib 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rs48_lib 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rs48_lib" -version = "1.2.0" +version = "1.3.0" dependencies = [ "rand", + "rayon", "termion", ] [[package]] name = "rs48_lib" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e4957f52e96513f08ec15e07df67c85f3ac7d24ccb2cbda03279435651b37a5" +checksum = "b58576c33a2c3e1fd0af4195b55f9d8cf52f0448d5f487b7df934a395b8dbce2" dependencies = [ "rand", + "rayon", "termion", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "strsim" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 1f9816b..58b2e8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] members = ["rs48", "rs48_lib"] - +default-members = ["rs48"] diff --git a/README.md b/README.md index 1c781e4..c2c6ad4 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,23 @@ configurability and implements a few types of AI. Compiled with the [rustup toolchain](https://rustup.rs). +### Installing +```sh +cargo install rs48 +``` + +alternatively, you can clone this repo and build it yourself. + ### Building -```powershell -cargo build +```sh +git clone "https://github.com/MajorBarnulf/rs48.git" +cd rs48/rs48 +cargo build -r ``` ### Running -```powershell -cargo run +```sh +cargo run -r ``` From 612127db1981b6bce302554f4449ddd3c6d53a95 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 15:56:06 +0200 Subject: [PATCH 03/10] added help in readme --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index c2c6ad4..4390626 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,28 @@ cargo build -r ```sh cargo run -r ``` + +### Help +```s +Usage: rs48 [OPTIONS] + +Options: + -s, --size + size of the grid on which the game is played [default: 4] + -w, --spawn + number of tiles that will spawn on the grid each turn [default: 1] + --no-clear + disable clearing the terminal to refresh the screen + -k, --display-skips + skips the refresh of that many turns, allow AIs to play faster [default: 0] + -d, --delay + delay in ms to add between each turns [default: 0] + -c, --controller + the controller to use for the game [default: player] + --color-seed + sets a seed for the color pattern, 0 for random, default is 35 [default: 35] + -h, --help + Print help information + -V, --version + Print version information +``` \ No newline at end of file From 1ef87c01e33f1399c2899bedbab02f387ced36b6 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 15:57:00 +0200 Subject: [PATCH 04/10] made binary the default member --- Cargo.lock | 2 +- rs48/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b24b115..a48d218 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "rs48" -version = "1.3.0" +version = "1.3.1" dependencies = [ "clap", "rand", diff --git a/rs48/Cargo.toml b/rs48/Cargo.toml index c5ae5c3..f90d0b7 100644 --- a/rs48/Cargo.toml +++ b/rs48/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs48" -version = "1.3.0" +version = "1.3.1" edition = "2021" description = "A game of 2048 that plays in the terminal as a TUI with a lot of configurability." license = "GPL-3.0" From 2a1ca7be6bb091e7d0cdac9b85af7e043bb47252 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 16:00:18 +0200 Subject: [PATCH 05/10] added virtual readme as link --- rs48/README.md | 1 + 1 file changed, 1 insertion(+) create mode 120000 rs48/README.md diff --git a/rs48/README.md b/rs48/README.md new file mode 120000 index 0000000..32d46ee --- /dev/null +++ b/rs48/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file From 715ca44014ddb235aa1a1929070be8abbbe58031 Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Thu, 29 Sep 2022 16:02:09 +0200 Subject: [PATCH 06/10] bumped version --- Cargo.lock | 2 +- rs48/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a48d218..8c2b060 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,7 +308,7 @@ dependencies = [ [[package]] name = "rs48" -version = "1.3.1" +version = "1.3.2" dependencies = [ "clap", "rand", diff --git a/rs48/Cargo.toml b/rs48/Cargo.toml index f90d0b7..32a816e 100644 --- a/rs48/Cargo.toml +++ b/rs48/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs48" -version = "1.3.1" +version = "1.3.2" edition = "2021" description = "A game of 2048 that plays in the terminal as a TUI with a lot of configurability." license = "GPL-3.0" From cb2cdd29eb936464f5136f262bcc85c26abfb515 Mon Sep 17 00:00:00 2001 From: mb Date: Fri, 30 Sep 2022 16:23:04 +0200 Subject: [PATCH 07/10] fixed --- rs48_lib/src/controller/simulated.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/rs48_lib/src/controller/simulated.rs b/rs48_lib/src/controller/simulated.rs index 41826a7..2740007 100644 --- a/rs48_lib/src/controller/simulated.rs +++ b/rs48_lib/src/controller/simulated.rs @@ -50,7 +50,6 @@ impl Controller for SimulatedController { .collect(); scores.sort_by(|(_, a), (_, b)| b.cmp(a)); - dbg!(&scores); let (m, _) = scores.first().unwrap(); Ok(m.clone()) } From e9766f074a41038084508a2bf12578a1dc81a6c7 Mon Sep 17 00:00:00 2001 From: mb Date: Fri, 30 Sep 2022 16:25:47 +0200 Subject: [PATCH 08/10] bumped version --- rs48_lib/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs48_lib/Cargo.toml b/rs48_lib/Cargo.toml index 4811655..0298751 100644 --- a/rs48_lib/Cargo.toml +++ b/rs48_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs48_lib" -version = "1.3.0" +version = "1.3.1" edition = "2021" description = "components of rs48" license = "MIT" From dda4b4b5195a2dfbc1cbce2a7e6ccf18caa604d6 Mon Sep 17 00:00:00 2001 From: mb Date: Fri, 30 Sep 2022 16:27:18 +0200 Subject: [PATCH 09/10] bumped version, added target link for aur scripts --- rs48/Cargo.toml | 4 ++-- rs48/target | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 120000 rs48/target diff --git a/rs48/Cargo.toml b/rs48/Cargo.toml index 32a816e..ddf8807 100644 --- a/rs48/Cargo.toml +++ b/rs48/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rs48" -version = "1.3.2" +version = "1.3.3" edition = "2021" description = "A game of 2048 that plays in the terminal as a TUI with a lot of configurability." license = "GPL-3.0" @@ -10,5 +10,5 @@ homepage = "https://github.com/MajorBarnulf/rs48" [dependencies] clap = { version = "4.0", features = ["derive"] } -rs48_lib = "1.3" +rs48_lib = "1.3.1" rand = "0.8" diff --git a/rs48/target b/rs48/target new file mode 120000 index 0000000..78bc337 --- /dev/null +++ b/rs48/target @@ -0,0 +1 @@ +../target \ No newline at end of file From c8ee421f34889ce05e92990f9e98ba5350a29896 Mon Sep 17 00:00:00 2001 From: mb Date: Sat, 1 Oct 2022 18:28:34 +0200 Subject: [PATCH 10/10] updated lock --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c2b060..0321dbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,16 +308,16 @@ dependencies = [ [[package]] name = "rs48" -version = "1.3.2" +version = "1.3.3" dependencies = [ "clap", "rand", - "rs48_lib 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rs48_lib 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rs48_lib" -version = "1.3.0" +version = "1.3.1" dependencies = [ "rand", "rayon", @@ -326,9 +326,9 @@ dependencies = [ [[package]] name = "rs48_lib" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b58576c33a2c3e1fd0af4195b55f9d8cf52f0448d5f487b7df934a395b8dbce2" +checksum = "7bb1258263e47505149cd6fb2224598a6d790bbef3d20884360cc3b983b02360" dependencies = [ "rand", "rayon",