30 Commits

Author SHA1 Message Date
amjad
a20b3ff31f Merge branch 'sourcery/main' of https://github.com/amjadkofahi/basic-computer-games into sourcery/main 2024-08-19 04:09:55 +03:00
Sourcery AI
71d02673a9 'Refactored by Sourcery' 2024-08-19 03:46:27 +03:00
Flavio Poletti
870df015c3 Add Perl implementation for Hammurabi 2023-10-22 22:35:43 +02:00
lmstolton
7dff2a67e7 Changed get_input() to return Option<u32> 2023-09-04 19:29:18 +01:00
Guido Knips
7a62098e94 Un-ignore Cargo.lock
Official cargo documentation says Cargo.lock should be
under version control for binaries (but not for libraries)

see https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries
2023-08-28 21:06:35 +02:00
Jeff Atwood
0b7b162f9f Merge pull request #890 from lmstolton/hamurabi
Added Rust version of 43_Hammurabi
2023-08-27 13:32:15 -07:00
Lyndon Stolton
6555d1cf2d Minor changes to 43_Hammurabi/rust
- Minor changes to make code more idiomatic (clippy no longer has any
issues), no functional changes

- Added some additional comments to make code easier to follow
2023-08-27 21:13:26 +01:00
Lyndon Stolton
41ef1ba818 Added Rust version of 43_Hammurabi 2023-08-27 17:40:30 +01:00
JoeStrout
238a31fcd5 Added MiniScript version of 43_Hammurabi. 2023-08-15 16:38:40 -07:00
Ethan Dicks
a46a2576e5 Corrected typo in Hamurabi summary report 2022-10-17 00:10:55 -04:00
Martin Thoma
ae0b6a5015 BUG: Hangman (Python) had a List-vs-Str comparison
MAINT: Add type annotations to find such issues
2022-03-31 10:33:11 +02:00
Martin Thoma
17a75813b1 Remove tests and alternative Python implementations
Ad discussed here:
https://github.com/coding-horror/basic-computer-games/issues/548#issuecomment-1081008471
2022-03-29 07:02:10 +02:00
Martin Thoma
83b3dc402c Python: Add type annotations 2022-03-20 19:16:39 +01:00
Jeff Atwood
f40a1fc465 add Porting Notes to readme.md for each game 2022-03-18 19:50:22 -07:00
Martin Thoma
f52d9a0e54 Clean Code: Python
Fix issues found by flake8-bugbear:

* Unused loop variables
* assert statements in non-test code
* mixing test code with production code
* mark one excessive test which takes ~10min to run
  as 'slow'
2022-03-18 14:59:08 +01:00
Jeff Atwood
6f6ac93d1f Merge pull request #633 from mojoaxel/js-terminal-style
Add "nice" terminal style stylesheet for javascript html
2022-03-15 23:50:18 -05:00
Jeff Atwood
43f2ec013a add 00_Alternate_Langage folder and move alternate ports there 2022-03-15 20:49:07 -07:00
Alexander Wunschik
f2b3d6f2ed add terminal-stylesheet for javascript html 2022-03-13 11:23:05 +01:00
Martin Thoma
af88007734 Python: Fix Flake8 E722 and E741
Additionally:

* Use functions to group blocks of code
* Use variable names (not just one character...)
2022-03-12 08:17:03 +01:00
Martin Thoma
4adb34f25c Python: Fix code style issues 2022-03-11 07:44:56 +01:00
Martin Thoma
e64fb6795c MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
2022-03-05 09:29:23 +01:00
Zev Spitz
56679d99d6 Simplify Hammurabi (C#) folder structure 2022-01-17 09:21:33 +02:00
Zev Spitz
75def2707d Add sln and csroj/vbproj files where missing 2022-01-16 08:17:31 +02:00
Stephen Childs
94a65239d5 Allow max fields to be worked in python Hamurabi.
In the BASIC version the calculation is on line 455:

`455 IF D<10*P THEN 510`

Which skips over the not enough people message.

In the Python version the logic is reversed, and we check
to see if there is too few people and then run the message:

`elif D >= 10 * P` (in the current code).

However, this means that the case where you want to plant the
maximum number of acres won't work.

e.g. You have 100 people (P) and want to plant 1000 acres (D).

`1000 >= 10 * 100`
`1000 >= 1000`

Which triggers the "not enough people code".

Maybe this is a bug in the original program.
2022-01-13 11:04:43 -05:00
Stephen Childs
6c1adde205 Move harvest calculation outside rat condition.
This fixes an error where the harvest was only added
to the total bushels if rats ate some.

Note in the BASIC file, we check to see if rats eat
the grain in line 522 and if not, go to line 530,
which is where the `S=S-E+H` calculation is done.
2022-01-13 10:56:50 -05:00
Bill Cruise
a360ca17ca Return a value from gen_random function. 2022-01-08 13:18:09 -05:00
Bill Cruise
d5a2260796 Reformat to make code more Pythonic and (hopefully) readable. 2022-01-08 12:56:44 -05:00
Eric S Weilnau
cf9c2328b3 Format external links 2022-01-04 18:38:07 -05:00
LukasMurdock
76c5e1e995 add 17-96 2022-01-03 02:13:21 -05:00
Chris Reuter
d26dbf036a Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment.
This change fixes that.
2021-11-21 18:30:21 -05:00