Joe Nellis
8bc2b33a58
Refactoring to distinguish setup of the game from the actual game. Changing globals to uppercase to signal constancy while assigning them via return from #setup_game. The two remaining mutable globals are for score keeping. Maintain commenting style of multistring inside method body.
2022-04-29 22:20:22 -07:00
Joe Nellis
cca3f941d2
More cleanup refactoring, losing unused variables, shadowed globals, unnecessary spaces, and long lines, and debug prints.
2022-04-29 17:34:31 -07:00
Joe Nellis
4308713ec2
Refactoring of the #get_possibility and #make_human_readable methods into one method, #possibility_to_color_code, that just converts a solution permutation (out of the possible permutations) straight into a string code of letters.
...
Both of these methods are essentially a flow of the first method being fed into the second and thus they are combined and the intermediate data structure (List[int]) is no longer needed.
2022-04-29 17:10:10 -07:00
Joe Nellis
44983bb25f
More off by 1 errors of the same type as the previous commit for the computer guessing the secret code. All errors are involved in the algortihm that converts an empty list to a guess.
2022-04-29 13:54:53 -07:00
Joe Nellis
bacad32a61
Off by one error in for/range. Previously if the computer chose a secret code of zero (all blacks) it would skip initialization entirely and the player would not be able to finish the puzzle. Alternatively, if the computer chose the highest secret code (e.g. all Red in a three color puzzle), the actual secret code would be initialized to one less (RRW).
2022-04-24 17:39:03 -07:00
Joe Nellis
5ff1717a53
Unfixes the fix introduced in a previous commit regarding how the computer deduces the answer. ReadMe updated with a thorough explanation of the deduction process.
2022-04-08 21:59:14 -07:00
Martin Thoma
ac184fec42
Python: Type annotations
2022-04-02 10:56:43 +02:00
Martin Thoma
a561322962
Python: Add type annotations
2022-04-02 09:30:56 +02:00
Martin Thoma
4b3b991273
Use docstrings
2022-04-02 08:10:01 +02:00
Martin Thoma
1b1d50986b
Python: Add type annotations to all 'print' functions ( #662 )
...
* Add test to superstartrek and fixes several issues in superstartrek - I probably introduced them 🙈
* Mastermind type annotations
2022-03-21 10:41:14 +01: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
Martin Thoma
4adb34f25c
Python: Fix code style issues
2022-03-11 07:44:56 +01:00
Anthony Rubick
65a5d5987c
Merge branch 'main' into fix-logic-error-in-60_mastermind
2022-03-07 09:04:07 +00:00
AnthonyMichaelTDM
98f47dfa44
fix for potential logic error
...
should fix the conflict
2022-03-07 01:02:09 -08:00
AnthonyMichaelTDM
eaff44a86a
fix for potential logic error
2022-03-07 00:35:18 -08: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
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