basic-computer-games icon indicating copy to clipboard operation
basic-computer-games copied to clipboard

56 life for two python

Open sajidsarker opened this issue 3 years ago • 4 comments

I've created a port for 56 - Life for Two in Python!

However, it appears there is some issue with some of the logic which I could not parse clearly from BASIC (terrible nesting of GOTOs), so I needed to check the available Javascript port as reference.

I wished to open a pull request for now, hopefully allowing others to have eyes on whether I made a mistake or otherwise.

sajidsarker avatar Jun 28 '22 22:06 sajidsarker

python checks failed?

coding-horror avatar Jul 01 '22 04:07 coding-horror

Dear Jeff (@coding-horror)

python checks failed?

I made the fix and am trying again. Sorry, I was travelling and could not attend to this!

I have added one new commit with a correction based on the suggestion of the Python validation check output:

from typing import List

sajidsarker avatar Jul 15 '22 11:07 sajidsarker

Here's the error from the failed check

Run mypy . --exclude [7](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:8)9_Slalom --exclude 27_Civil_War --exclude 3[8](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:9)_Fur_Trader --exclude 81_Splat --exclude 0[9](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:10)_Battle --exclude 40_Gomoko --exclude 36_Flip_Flop --exclude 43_Hammurabi --exclude 04_Awari --exclude 78_Sine_Wave --exclude 77_Salvo --exclude 34_Digits --exclude 17_Bullfight --exclude 16_Bug
56_Life_for_Two/python/life_for_two.py:22: error: Argument 1 to "append" of "list" has incompatible type "List[<nothing>]"; expected "int"
56_Life_for_Two/python/life_for_two.py:24: error: "int" has no attribute "append"
56_Life_for_Two/python/life_for_two.py:50: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:60: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:61: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:67: error: Value of type "int" is not indexable
56_Life_for_Two/python/life_for_two.py:68: error: Value of type "int" is not indexable
56_Life_for_Two/python/life_for_two.py:70: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:70: error: Value of type "int" is not indexable
56_Life_for_Two/python/life_for_two.py:90: error: Value of type "int" is not indexable
56_Life_for_Two/python/life_for_two.py:91: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:95: error: Value of type "int" is not indexable
56_Life_for_Two/python/life_for_two.py:99: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:[10](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:11)3: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:107: error: Unsupported target for indexed assignment ("int")
56_Life_for_Two/python/life_for_two.py:[11](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:12)5: error: Incompatible types in assignment (expression has type "str", variable has type "List[str]")
56_Life_for_Two/python/life_for_two.py:1[16](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:17): error: Incompatible types in assignment (expression has type "str", variable has type "List[str]")
56_Life_for_Two/python/life_for_two.py:1[17](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:18): error: "List[str]" has no attribute "split"
56_Life_for_Two/python/life_for_two.py:1[18](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:19): error: "List[str]" has no attribute "split"
Found [19](https://github.com/coding-horror/basic-computer-games/runs/7437486918?check_suite_focus=true#step:5:20) errors in 1 file (checked 86 source files)
Error: Process completed with exit code 1.

coding-horror avatar Jul 20 '22 20:07 coding-horror

Dear Jeff (@coding-horror)

I've gone ahead and removed the type hinting to avoid these errors altogether!

Thank you very much for the review!

sajidsarker avatar Jul 24 '22 05:07 sajidsarker