Python Forum
Game of life using IDLE
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Game of life using IDLE
#1
Hello, im creating the famous game of life, but without using pygame, numpy and all other programs, just the basic IDLE. My plan is to create a window consisting of 6 buttons (START CLEAR RANDOMIZE LOAD SAVE QUIT) where for each button python performs different tasks. 
Im almost there ( i think) but i just cant seem to go any further, no matter which way i try to program. Please help eather with the program itself or tips or anything is greatly appreciated!! :) 




Error:
The error I recieve: Traceback (most recent call last):   File "C:\Users\game.py", line 287, in <module>     window2()   File "C:\Users\game.py", line 226, in window2     if point1.getY > 0: TypeError: unorderable types: method() > int()
Reply
#2
Try to call the function by adding ():  
if point1.getY() > 0:
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#3
Quote:        if point1.getY > 0:
I presume you meant to call the function via adding parens
        if point1.getY() > 0:
Recommended Tutorials:
Reply
#4
yes thats it! In addition i found another small mistake. Even though the program still doesnt work as it should i feel like im on the right path this time. Thanks guys!!!

How would you suggest is the best way to fix this problem:
Error:
Traceback (most recent call last):  File "C:\Users\game.py", line 293, in <module>    window2()  File "C:\Users\game.py", line 273, in window2    changes = iterate(board)[2] IndexError: tuple index out of range
If i would add another variable in iterate() program it would give another error:
Traceback (most recent call last):
Error:
 File "C:\Users\game.py", line 293, in <module>    window2()  File "C:\Users\game.py", line 284, in window2    rectangles = update_color(x,'update',update,rectangles)  File "C:\Users\game.py", line 77, in update_color    if (board[x][y]): TypeError: 'bool' object is not subscriptable
Reply
#5
It's hard to answer your questions without seeing your code. You need to look at what's coming out of iterate(board) to see why it doesn't have three items. In the second one you need to look at the board variable. Is it being set to a boolean at some point? Is board[x] a boolean? These are the questions you have to ask yourself in order to solve the problem, but we can't answer them because we can't see the rest of your program.

You're program is probably pretty big, at least bigger than we have the time or inclination to wade through. So we typically suggest trimming down your program to a small chunk of code that replicates the error, say 10 to 20 lines of code. You will often find that trying to isolate the error like this will allow you to solve the problem yourself. If not, it will help us solve the problem.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  While loop/half-life Miraclefruit 6 8,422 Mar-06-2017, 05:24 PM
Last Post: nilamo
  conway's game of life / Single Responsibility Principle hanscvanleeuwen 13 11,031 Dec-17-2016, 08:30 AM
Last Post: hanscvanleeuwen
  conway's game of life hanscvanleeuwen 17 17,730 Dec-09-2016, 04:05 PM
Last Post: hanscvanleeuwen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020