Skip to content

Commit f062b60

Browse files
Merge pull request #895 from GKnirps/implement_king
Implement King in rust
2 parents 9e0065b + 0e86198 commit f062b60

File tree

5 files changed

+631
-1
lines changed

5 files changed

+631
-1
lines changed

53_King/rust/Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

53_King/rust/Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "king"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
fastrand = "^2.0.0"

53_King/rust/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
King
2+
====
3+
4+
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
5+
6+
Conversion to [rust](https://www.rust-lang.org/).
7+
8+
Porting Notes
9+
-------------
10+
11+
### Floats
12+
13+
The original code implicitly uses floating point numbers in many places which are explicitly cast to integers. In this port, I avoided using floats and tried to replicate the behaviour using just integers. It is possible that I missed some places where rounding a value would have made a difference. If you find such a bug, please notify me or make implement a fix yourself.
14+
15+
### Signed Numbers
16+
17+
I used unsigned integers for most of the program because it was easier than to check for negative values all the time. Unfortunately, that made the code a bit whacky in one or two places.
18+
19+
Since I only allow input of positive numbers, it is not possible to exit the game when entering the stats to resume a game, which would be possible by entering negative numbers in the original game.
20+
21+
### Bugs
22+
23+
I tried to fix all bugs listed in the [main README for King](../README.md). I have tested this implementation a bit but not extensively, so there may be some portation bugs. If you find them, you are free to fix them.
24+
25+
Future Development
26+
------------------
27+
28+
I plan to add some tests and tidy up the code a bit, but this version should be feature-complete.

0 commit comments

Comments
 (0)