commit
6492e35ba5
@ -0,0 +1,2 @@ |
||||
/target |
||||
.idea |
@ -0,0 +1,590 @@ |
||||
# This file is automatically @generated by Cargo. |
||||
# It is not intended for manual editing. |
||||
[[package]] |
||||
name = "ab_glyph_rasterizer" |
||||
version = "0.1.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "19eabfa36efffae27d62d530e30eb951e3d9a999d23c0d58cb010a27e3916744" |
||||
|
||||
[[package]] |
||||
name = "adler32" |
||||
version = "1.0.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" |
||||
|
||||
[[package]] |
||||
name = "approx" |
||||
version = "0.3.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" |
||||
dependencies = [ |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "autocfg" |
||||
version = "1.0.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" |
||||
|
||||
[[package]] |
||||
name = "bitflags" |
||||
version = "1.2.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" |
||||
|
||||
[[package]] |
||||
name = "bytemuck" |
||||
version = "1.2.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" |
||||
|
||||
[[package]] |
||||
name = "byteorder" |
||||
version = "1.3.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" |
||||
|
||||
[[package]] |
||||
name = "cfg-if" |
||||
version = "0.1.10" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |
||||
|
||||
[[package]] |
||||
name = "color_quant" |
||||
version = "1.0.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" |
||||
|
||||
[[package]] |
||||
name = "conv" |
||||
version = "0.3.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" |
||||
dependencies = [ |
||||
"custom_derive", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "crc32fast" |
||||
version = "1.2.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" |
||||
dependencies = [ |
||||
"cfg-if", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "crossbeam-deque" |
||||
version = "0.7.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" |
||||
dependencies = [ |
||||
"crossbeam-epoch", |
||||
"crossbeam-utils", |
||||
"maybe-uninit", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "crossbeam-epoch" |
||||
version = "0.8.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"cfg-if", |
||||
"crossbeam-utils", |
||||
"lazy_static", |
||||
"maybe-uninit", |
||||
"memoffset", |
||||
"scopeguard", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "crossbeam-queue" |
||||
version = "0.2.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" |
||||
dependencies = [ |
||||
"cfg-if", |
||||
"crossbeam-utils", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "crossbeam-utils" |
||||
version = "0.7.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"cfg-if", |
||||
"lazy_static", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "custom_derive" |
||||
version = "0.1.7" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" |
||||
|
||||
[[package]] |
||||
name = "deflate" |
||||
version = "0.8.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" |
||||
dependencies = [ |
||||
"adler32", |
||||
"byteorder", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "either" |
||||
version = "1.5.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" |
||||
|
||||
[[package]] |
||||
name = "gammon" |
||||
version = "0.1.0" |
||||
dependencies = [ |
||||
"image", |
||||
"imageproc", |
||||
"rusttype 0.9.0", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "getrandom" |
||||
version = "0.1.14" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" |
||||
dependencies = [ |
||||
"cfg-if", |
||||
"libc", |
||||
"wasi", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "gif" |
||||
version = "0.10.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" |
||||
dependencies = [ |
||||
"color_quant", |
||||
"lzw", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "hermit-abi" |
||||
version = "0.1.11" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" |
||||
dependencies = [ |
||||
"libc", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "image" |
||||
version = "0.23.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "9117f4167a8f21fa2bb3f17a652a760acd7572645281c98e3b612a26242c96ee" |
||||
dependencies = [ |
||||
"bytemuck", |
||||
"byteorder", |
||||
"gif", |
||||
"jpeg-decoder", |
||||
"num-iter", |
||||
"num-rational", |
||||
"num-traits", |
||||
"png", |
||||
"scoped_threadpool", |
||||
"tiff", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "imageproc" |
||||
version = "0.20.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "4552f3c2cbcf66e0451863120805b480fc421a7a8cf45f19eee5fc4a6fc3a3d3" |
||||
dependencies = [ |
||||
"conv", |
||||
"image", |
||||
"itertools", |
||||
"num 0.2.1", |
||||
"rand", |
||||
"rand_distr", |
||||
"rayon", |
||||
"rulinalg", |
||||
"rusttype 0.8.3", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "inflate" |
||||
version = "0.4.5" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" |
||||
dependencies = [ |
||||
"adler32", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "itertools" |
||||
version = "0.8.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" |
||||
dependencies = [ |
||||
"either", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "jpeg-decoder" |
||||
version = "0.1.18" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "0256f0aec7352539102a9efbcb75543227b7ab1117e0f95450023af730128451" |
||||
dependencies = [ |
||||
"byteorder", |
||||
"rayon", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "lazy_static" |
||||
version = "1.4.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" |
||||
|
||||
[[package]] |
||||
name = "libc" |
||||
version = "0.2.69" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" |
||||
|
||||
[[package]] |
||||
name = "log" |
||||
version = "0.4.8" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" |
||||
dependencies = [ |
||||
"cfg-if", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "lzw" |
||||
version = "0.10.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" |
||||
|
||||
[[package]] |
||||
name = "matrixmultiply" |
||||
version = "0.1.15" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" |
||||
dependencies = [ |
||||
"rawpointer", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "maybe-uninit" |
||||
version = "2.0.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" |
||||
|
||||
[[package]] |
||||
name = "memoffset" |
||||
version = "0.5.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" |
||||
dependencies = [ |
||||
"autocfg", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "miniz_oxide" |
||||
version = "0.3.6" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" |
||||
dependencies = [ |
||||
"adler32", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num" |
||||
version = "0.1.42" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" |
||||
dependencies = [ |
||||
"num-integer", |
||||
"num-iter", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num" |
||||
version = "0.2.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" |
||||
dependencies = [ |
||||
"num-bigint", |
||||
"num-complex", |
||||
"num-integer", |
||||
"num-iter", |
||||
"num-rational", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-bigint" |
||||
version = "0.2.6" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"num-integer", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-complex" |
||||
version = "0.2.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-integer" |
||||
version = "0.1.42" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-iter" |
||||
version = "0.1.40" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"num-integer", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-rational" |
||||
version = "0.2.4" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" |
||||
dependencies = [ |
||||
"autocfg", |
||||
"num-bigint", |
||||
"num-integer", |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num-traits" |
||||
version = "0.2.11" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" |
||||
dependencies = [ |
||||
"autocfg", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "num_cpus" |
||||
version = "1.13.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" |
||||
dependencies = [ |
||||
"hermit-abi", |
||||
"libc", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "ordered-float" |
||||
version = "1.0.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" |
||||
dependencies = [ |
||||
"num-traits", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "png" |
||||
version = "0.16.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "2c68a431ed29933a4eb5709aca9800989758c97759345860fa5db3cfced0b65d" |
||||
dependencies = [ |
||||
"bitflags", |
||||
"crc32fast", |
||||
"deflate", |
||||
"inflate", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "ppv-lite86" |
||||
version = "0.2.6" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" |
||||
|
||||
[[package]] |
||||
name = "rand" |
||||
version = "0.7.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" |
||||
dependencies = [ |
||||
"getrandom", |
||||
"libc", |
||||
"rand_chacha", |
||||
"rand_core", |
||||
"rand_hc", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rand_chacha" |
||||
version = "0.2.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" |
||||
dependencies = [ |
||||
"ppv-lite86", |
||||
"rand_core", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rand_core" |
||||
version = "0.5.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" |
||||
dependencies = [ |
||||
"getrandom", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rand_distr" |
||||
version = "0.2.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" |
||||
dependencies = [ |
||||
"rand", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rand_hc" |
||||
version = "0.2.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" |
||||
dependencies = [ |
||||
"rand_core", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rawpointer" |
||||
version = "0.1.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" |
||||
|
||||
[[package]] |
||||
name = "rayon" |
||||
version = "1.3.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" |
||||
dependencies = [ |
||||
"crossbeam-deque", |
||||
"either", |
||||
"rayon-core", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rayon-core" |
||||
version = "1.7.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" |
||||
dependencies = [ |
||||
"crossbeam-deque", |
||||
"crossbeam-queue", |
||||
"crossbeam-utils", |
||||
"lazy_static", |
||||
"num_cpus", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rulinalg" |
||||
version = "0.4.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "04ada202c9685e1d72a7420c578e92b358dbf807d3dfabb676a3dab9cc3bb12f" |
||||
dependencies = [ |
||||
"matrixmultiply", |
||||
"num 0.1.42", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rusttype" |
||||
version = "0.8.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0" |
||||
dependencies = [ |
||||
"approx", |
||||
"ordered-float", |
||||
"stb_truetype", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "rusttype" |
||||
version = "0.9.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "40cbe3f2bab536ff4784f14f2a73f1e37550ceb36a074c47a8f4150f57182049" |
||||
dependencies = [ |
||||
"ab_glyph_rasterizer", |
||||
"ttf-parser", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "scoped_threadpool" |
||||
version = "0.1.9" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" |
||||
|
||||
[[package]] |
||||
name = "scopeguard" |
||||
version = "1.1.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" |
||||
|
||||
[[package]] |
||||
name = "stb_truetype" |
||||
version = "0.3.1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" |
||||
dependencies = [ |
||||
"byteorder", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "tiff" |
||||
version = "0.4.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "002351e428db1eb1d8656d4ca61947c3519ac3191e1c804d4600cd32093b77ad" |
||||
dependencies = [ |
||||
"byteorder", |
||||
"lzw", |
||||
"miniz_oxide", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "ttf-parser" |
||||
version = "0.5.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "afa7e68b11bcf63b8a990bd7fe894dece47a629dbbba0fce4dbecb4dbac3ef8d" |
||||
dependencies = [ |
||||
"log", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "wasi" |
||||
version = "0.9.0+wasi-snapshot-preview1" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" |
@ -0,0 +1,12 @@ |
||||
[package] |
||||
name = "gammon" |
||||
version = "0.1.0" |
||||
authors = ["Ondřej Hruška <ondra@ondrovo.com>"] |
||||
edition = "2018" |
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
||||
|
||||
[dependencies] |
||||
image = "0.23.4" |
||||
imageproc = "0.20.0" |
||||
rusttype = "0.9.0" |
@ -0,0 +1,198 @@ |
||||
use std::default::Default; |
||||
|
||||
mod bgm { |
||||
use std::fmt; |
||||
use std::default::Default; |
||||
use std::fmt::Display; |
||||
|
||||
use image::{Rgb, RgbImage}; |
||||
use imageproc::drawing::draw_text_mut; |
||||
use rusttype::{FontCollection, Scale}; |
||||
|
||||
#[derive(Debug,Clone,Copy,Eq,PartialEq)] |
||||
pub enum Color { |
||||
Black = 0, |
||||
White = 1, |
||||
} |
||||
|
||||
#[derive(Debug,Clone,Copy)] |
||||
pub enum Phase { |
||||
PickSides, |
||||
Turn(Color), |
||||
} |
||||
|
||||
#[derive(Debug,Clone,Default)] |
||||
pub struct Player { |
||||
pub born_off: u32, |
||||
pub on_bar: u32, |
||||
} |
||||
|
||||
#[derive(Debug,Clone,Copy)] |
||||
pub enum Bin { |
||||
Free, |
||||
Black(u32), |
||||
White(u32), |
||||
} |
||||
|
||||
#[derive(Debug)] |
||||
pub struct Game { |
||||
pub phase : Phase, |
||||
pub multiplier : u32, |
||||
pub roll : [u8; 2], |
||||
pub players : [Player; 2], |
||||
pub bins : [Bin; 24], |
||||
} |
||||
|
||||
impl Default for Game { |
||||
fn default() -> Self { |
||||
Game { |
||||
phase: Phase::PickSides, |
||||
multiplier: 1, |
||||
roll: [0; 2], |
||||
players: [ |
||||
Player::default(), |
||||
Player::default(), |
||||
], |
||||
bins: [Bin::Free; 24], |
||||
} |
||||
} |
||||
} |
||||
|
||||
impl Display for Game { |
||||
fn fmt(&self, f : &mut fmt::Formatter<'_>) -> fmt::Result { |
||||
/* |
||||
|
||||
const BLACK_DIGITS : [char; 20] = [ |
||||
'❶', '❷', '❸', '❹', '❺', '❻', '❼', '❽', '❾', '❿', |
||||
'⓫', '⓬', '⓭', '⓮', '⓯', '⓰', '⓱', '⓲', '⓳', '⓴', |
||||
]; |
||||
|
||||
const WHITE_DIGITS : [char; 20] = [ |
||||
'➀', '➁', '➂', '➃', '➄', '➅', '➆', '➇', '➈', '➉', |
||||
'⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳', |
||||
]; |
||||
|
||||
write!(f, "13 14 15 16 17 18 19 20 21 22 23 24\n")?; |
||||
for b in &self.bins[12..=23] { |
||||
match *b { |
||||
Bin::Free => write!(f, "-- ")?, |
||||
Bin::Black(n) => { |
||||
if n > 0 && n <= BLACK_DIGITS.len() as u32 { |
||||
write!(f, "{} ", BLACK_DIGITS[(n-1) as usize])?; |
||||
} else { |
||||
write!(f, "{} ", n)?; |
||||
} |
||||
} |
||||
Bin::White(n) => { |
||||
if n > 0 && n <= WHITE_DIGITS.len() as u32 { |
||||
write!(f, "{} ", WHITE_DIGITS[(n-1) as usize])?; |
||||
} else { |
||||
write!(f, "{} ", n)?; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
write!(f, "\n")?; |
||||
|
||||
for b in (&self.bins[0..=11]).iter().rev() { |
||||
match *b { |
||||
Bin::Free => write!(f, "-- ")?, |
||||
Bin::Black(n) => { |
||||
if n > 0 && n <= BLACK_DIGITS.len() as u32 { |
||||
write!(f, "{} ", BLACK_DIGITS[(n-1) as usize])?; |
||||
} else { |
||||
write!(f, "{} ", n)?; |
||||
} |
||||
} |
||||
Bin::White(n) => { |
||||
if n > 0 && n <= WHITE_DIGITS.len() as u32 { |
||||
write!(f, "{} ", WHITE_DIGITS[(n-1) as usize])?; |
||||
} else { |
||||
write!(f, "{} ", n)?; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
write!(f, "\n")?;
|
||||
write!(f, "12 11 10 9 8 7 6 5 4 3 2 1\n")?; |
||||
|
||||
*/ |
||||
|
||||
//*
|
||||
write!(f, " ")?; |
||||
for n in (13..=24).rev() { write!(f, "{:2}. ", n)?; } |
||||
write!(f, "\n╭ ")?; |
||||
|
||||
for b in &self.bins[12..=23] { |
||||
match *b { |
||||
Bin::Free => write!(f, "┈┈┈ ")?, |
||||
Bin::Black(n) => write!(f, "{:2}█ ", n)?, |
||||
Bin::White(n) => write!(f, "{:2}░ ", n)? |
||||
} |
||||
} |
||||
write!(f, "╴\n╰ ")?; |
||||
|
||||
for b in (&self.bins[0..=11]).iter().rev() { |
||||
match *b { |
||||
Bin::Free => write!(f, "┈┈┈ ")?, |
||||
Bin::Black(n) => write!(f, "{:2}█ ", n)?, |
||||
Bin::White(n) => write!(f, "{:2}░ ", n)? |
||||
} |
||||
} |
||||
|
||||
write!(f, "╴\n ")?; |
||||
for n in (1..=12).rev() { write!(f, "{:2}. ", n)?; } |
||||
write!(f, "\n")?; |
||||
//*/
|
||||
|
||||
/* |
||||
const DIGITS : &[u8; 36] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
||||
|
||||
write!(f, " 14 16 18 20 22 24\n")?; |
||||
write!(f, " 13╲╱15╲╱17╲╱19╲╱21╲╱23╲╱\n")?; |
||||
write!(f, "╭")?; |
||||
|
||||
for b in &self.bins[12..=23] { |
||||
match *b { |
||||
Bin::Free => write!(f, "──")?, |
||||
Bin::Black(n) => write!(f, "{}█", DIGITS[n as usize] as char)?, |
||||
Bin::White(n) => write!(f, "{}░", DIGITS[n as usize] as char)? |
||||
} |
||||
} |
||||
write!(f, "─┘\n╰")?; |
||||
|
||||
for b in (&self.bins[0..=11]).iter().rev() { |
||||
match *b { |
||||
Bin::Free => write!(f, "──")?, |
||||
Bin::Black(n) => write!(f, "{}█", DIGITS[n as usize] as char)?, |
||||
Bin::White(n) => write!(f, "{}░", DIGITS[n as usize] as char)? |
||||
} |
||||
} |
||||
|
||||
write!(f, "─┐\n")?; |
||||
write!(f, " 12╱╲10╱╲8.╱╲6.╱╲4.╱╲2.╱╲\n")?; |
||||
write!(f, " 11 9. 7. 5. 3. 1.\n")?; |
||||
*/ |
||||
|
||||
Ok(()) |
||||
} |
||||
} |
||||
} |
||||
|
||||
fn main() { |
||||
let mut board = bgm::Game::default(); |
||||
|
||||
board.bins[4] = bgm::Bin::Black(5); |
||||
board.bins[5] = bgm::Bin::Black(2); |
||||
board.bins[6] = bgm::Bin::Black(7);
|
||||
|
||||
board.bins[14] = bgm::Bin::White(9); |
||||
board.bins[15] = bgm::Bin::White(10); |
||||
board.bins[16] = bgm::Bin::White(11); |
||||
board.bins[2] = bgm::Bin::White(2); |
||||
|
||||
|
||||
println!("{}", board); |
||||
} |
Loading…
Reference in new issue