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]
g.antialiased[false]

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", "bold", .7]
   
while (length[freeCells] > 0)
{
   [row, col] = freeCells.removeRandom[]
   g.text[num, col + 1/2, row + 1/2]
   num = num + 1
}

g.writeFormat["-", "png", undef, 550]
%>

[Try numberCheckerboard.fsp]


Alan Eliasen was born 20203 days, 11 hours, 58 minutes ago.

Back to Frink Server Pages documentation.