numberCheckerboard.fsp - Frink Server Pages highlighter

[Try numberCheckerboard.fsp]

<%@ contentType="image/png" pageEncoding="raw" %>
<%
// This Frink Server Page renders graphics directly in memory.
// Reload it to see a new checkerboard.

g = new graphics

rows = 9
cols = 12

g.color[0,0,0]

freeCells = new array

for row = 0 to rows
   for col = 0 to cols
   {
      if (row + col) mod 2 == 0
         g.fillRectSize[col, row, 1, 1]
      else
         freeCells.push[[row,col]]
   }

num = 1
g.font["SansSerif", .75]
   
while (length[freeCells] > 0)
{
   [row, col] = freeCells.removeRandom[]
   g.text[num, col + 1/2, row + 1/2]
   num = num + 1
}

g.writeFormat["-", "png", 1000, 600]
%>

[Try numberCheckerboard.fsp]


Alan Eliasen was born 19944 days, 10 hours, 47 minutes ago.

Back to Frink Server Pages documentation.