Python Forum
Need help with a checkerboard algorythm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with a checkerboard algorythm
#3
(Sep-26-2020, 09:55 PM)bowlofred Wrote: Your parity is off. If you change the conditional to (x + y + 1)%2, it works. Or you could change your tests to be the reverse. That should work as well.

Wow, thank you very much for your help. It did indeed solve my issue.

Does that mean that changing the color to 255 and leaving it (x+y)%2 the color on the else statement to 255 will also help?

for y in range(n):
           if (x + y)%2:
               mat[x,y] = 255
           else:
               mat[x,y] = 0
Reply


Messages In This Thread
RE: Need help with a checkerboard algorythm - by giladal - Sep-27-2020, 10:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Truck Speedometer algorythm Roger454 4 2,776 Mar-19-2020, 01:40 AM
Last Post: Roger454

Forum Jump:

User Panel Messages

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