9th Oct 2021, 5:09 PM
Mohadek
Mohadek - avatar
22 ответов
+ 3
How about this? https://code.sololearn.com/csUViD8yqD3N/?ref=app Some typo error and floor division as suggested by other members here to get int instead of float values. See comments. I slowed it down for debugging.Plus I am not a good player... Never explored curses-based games. I also copy-pasted another version I found online. Seems easier to understand. Copy-paste to Pydroid3 to play. You cannot run this in Sololearn playground. Lots of code cannot run in Sololearn. https://code.sololearn.com/cgDhxzmR0s6y/?ref=app
11th Oct 2021, 6:08 AM
Bob_Li
Bob_Li - avatar
+ 1
Switch the float for int
9th Oct 2021, 7:59 PM
CGO!
CGO! - avatar
9th Oct 2021, 8:04 PM
CGO!
CGO! - avatar
+ 1
OK I'll try if it's work
11th Oct 2021, 6:35 AM
Mohadek
Mohadek - avatar
+ 1
Bob_Li thanks it worked
11th Oct 2021, 6:52 AM
Mohadek
Mohadek - avatar
0
I still don't get please do tell me more
9th Oct 2021, 6:59 PM
Mohadek
Mohadek - avatar
0
Why is it not working?
9th Oct 2021, 7:00 PM
Mohadek
Mohadek - avatar
0
If I do that the line 56 will be wrong how do I correct that?
9th Oct 2021, 7:15 PM
Mohadek
Mohadek - avatar
0
You sit down and think it through. You can do it. Look at the error carefully. Look at the spec you are writing the code to match and refer to the python documentation.
9th Oct 2021, 7:18 PM
Paul K Sadler
Paul K Sadler - avatar
0
OK thanks
9th Oct 2021, 7:18 PM
Mohadek
Mohadek - avatar
0
You were helpful
9th Oct 2021, 7:19 PM
Mohadek
Mohadek - avatar
0
You're welcome 😊
9th Oct 2021, 7:20 PM
Paul K Sadler
Paul K Sadler - avatar
0
Mohadek Hmmmm... Before, You want to do?
9th Oct 2021, 8:02 PM
CGO!
CGO! - avatar
0
Well int(12.0) is 12...
9th Oct 2021, 8:03 PM
Paul K Sadler
Paul K Sadler - avatar
0
Bob_Li that's true the game runs but with no keyboard control and then exits after that
11th Oct 2021, 2:42 PM
Mohadek
Mohadek - avatar
0
Men pythonda hakerlik qila olamanmi
11th Oct 2021, 3:54 PM
Abdulbosit
Abdulbosit - avatar
0
After digging around, I saw a suggestion to try executing the python code in command prompt, not the idle shell. Make sure you installed windows-curses. Yes, I can confirm this works. This link: https://www.devdungeon.com/content/curses-windows-python As the topic is about curses and console games, here is an interesting module: https://pypi.org/project/blessed/ Their version of snake game https://github.com/jquast/blessed/blob/master/bin/worms.py I installed it in Pydroid3 on my phone and ran the worms.py program. Colors to blow your mind...😁
12th Oct 2021, 5:06 AM
Bob_Li
Bob_Li - avatar
- 1
You have type errors, for example on line 20 w.addch(food[0], food[1], curses.ACS_PI) food[0] and food[1] are floats from the math on the line above, but int's are expected. The errors in the console are valuable troubleshooting tools. It tells you what's not working. At line 56 a similar issue exists.
9th Oct 2021, 6:57 PM
Paul K Sadler
Paul K Sadler - avatar
- 1
When the program gets to line 19 sh=24 and sw=80 Line 19 does division on each, dividing by 2 24/2=12.0 80/2=40.0 <--those are floats not int's If you do floor division // then the result is 24//2=12 and 80//2=40 <--both are int's I have not sat down and examined if the code meets the requirements of your task. I am just telling you why the code fails at line 20. This will hopefully get you started down the right track.
9th Oct 2021, 7:12 PM
Paul K Sadler
Paul K Sadler - avatar
- 1
How?
9th Oct 2021, 7:59 PM
Mohadek
Mohadek - avatar