Share your repls and programming experiences

← Back to all posts
Checker or chessboard
Thecatlover422 (0)

here is a chess or checkerboard! The squares are paterend, and it is the right way facing. it might take awilhe to draw the chess or checkerboard, though.

Comments
hotnewtop
DynamicSquid (4916)

Cool! Just a tip though:

# this:

if diagonal:
  diagonal = False
  starting_color = "beige"
  other_color = "gray"
else:
  diagonal = True
  starting_color = "gray"
  other_color = "beige"

# can be rewritten like this:

if diagonal:
  starting_color = "beige"
  other_color = "gray"
else:
  starting_color = "gray"
  other_color = "beige"

diagonal = not diagonal
Thecatlover422 (0)

@DynamicSquid thanks! I was coding with my code coach and another person, and the other person accidentally deleted the other way, so my code coach showed us the other way to do it (Was that confusing? Sry).

Thecatlover422 (0)

@Thecatlover422 but you did the last one a little differently and shorter then me, so thanks! I will add it when I'm not in a meeting!