function gameEnded() : boolean; var count, count2 : integer; begin (* First, check for across and down.*) for count := 1 to 3 do if(((board[1, count]=board[2, count]) and (board[2, count]=board[3, count]) and (board[1, count]<>Blank)) or ((board[count, 1]=board[count, 2]) and (board[count, 2]=board[count, 3]) and (board[count, 1]<>Blank))) then gameEnded := true; (* Now check for diagonals. *) (* And otherwise... *) gameEnded := false; end;