Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

PixelMath: Amusing solution to chessboard problem

I thought this might amuse.
I took up Adam's challenge and tried to create a chessboard pattern using PixelMath. Problem was, as an ex-programmer I knew I needed a modulus function but couldn't find it - I forgot it was the % sign and looked only at the Mod and Modulus functions.
So I created an artificial (and cumbersome) 'mod' function, but then found I needed to create an XOR function (not supported in PMath other than bitwise) to get the rows right. So my solution must be about the longest you've seen (see attached), but I got there in the end!

Two things worth mentioning: I used an 8x8 output image like a real chessboard, and I also took care of the fact that a chessboard should have a white square in the bottom right-hand corner.
Cheers
Peter

Comments

  • Love it! LOL Thanks for showing me.
    (x+y)%2 is pretty elegant as a starting point... I wish I had thought of it myself!
    -the Blockhead
Sign In or Register to comment.