Index arrays can be used to create patterns. The following example shows how one can create a chequerboard pattern using modulo, division without remainder, exclusive-or, and multiplication.

#!/usr/bin/env ruby require 'hornetseye' include Hornetseye raise "Syntax: checkerboard.rb <output file>" if ARGV.size != 1 x, y = Sequence.usint( 320 ).indgen!, Sequence.usint( 240 ).indgen! checker = MultiArray.tensor( 2 ) do |i,j| ( ( ( x[i] / 20 ) % 2 ) ^ ( ( y[j] / 20 ) % 2 ) ) * 0xFF end checker.save_ubyte ARGV[0]