' jdBasic Game of Life - Optimized with CONVOLVE
' Initial State: A "Glider"
board = PLACE(RESHAPE([0], [10, 10]), [[0, 1, 0], [0, 0, 1], [1, 1, 1]], [1, 1])
' Define the 3x3 kernel to sum up all neighbors including the cell itself.
kernel = RESHAPE([1], [3,3])
FOR I = 1 to 100
    CLS
    PRINT "jdBasic Game of Life"
    PRINT FRMV$(board) 
    board = (((board = 0) AND (CONVOLVE(board, kernel, 1) = 3)) OR ((board = 1) AND (CONVOLVE(board, kernel, 1) = 3 OR CONVOLVE(board, kernel, 1) = 4))) * 1 
    SLEEP 500
NEXT
