Saudações pessoal... Em um tempinho livre que tive (ninguem leu isso) fiz esse programinha pra rodar no CARACTER. O meu terminal usa a fonte Term então se aparecer esquisito já sabem... Coloco o código aqui para quem tiver curiosidade. Quem sabe qdo pintar outro tempinho eu faço no grafico. Valeo... Código: /*============================================================================== Programa...: mina.p Descricao..: Progress Minado Autor......: jalegria Data.......: 29/03/2010 Obs........: ==============================================================================*/ def var e as char view-as editor size 16 by 11. def var tile as int extent 160. def var qtd-bombas as int extent 2. def var rodape as char format 'X(12)'. def var tempo as int. def frame tela e at col 02 row 02 pfcolor 1 help ' [ESPA€O]-Abrir [ENTER] Marcar' rodape at col 04 row 13 with size 20 by 15 at col 3 row 2 no-labels dcolor 1 title dcolor 1 ' Progress Minado '. e:read-only = true. function Ganhou return log() forward. /*============================================================================== TRIGGERS ==============================================================================*/ on return of e run Marca(e:cursor-char, e:cursor-line). on any-printable of e do: if last-event:label = ' ' then run Abre(e:cursor-char, e:cursor-line). end. /*============================================================================== MAIN-BLOCK ==============================================================================*/ MAIN-BLOCK: DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK ON END-KEY UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK WITH FRAME tela: run Monta-Tabuleiro. enable e. wait-for 'close' of this-procedure focus e. end. /*============================================================================== P R O C E D U R E S ==============================================================================*/ PROCEDURE Refresh: def var i as int. i = e:cursor-offset in frame tela. rodape = fill(chr(235), qtd-bombas[1] - qtd-bombas[2]) + fill(chr(249), qtd-bombas[2]). disp e rodape with frame tela. e:cursor-offset = i. END PROCEDURE. /* -------------------------------------------------------------------------- */ FUNCTION XY2Index RETURNS INT(x as int, y as int): if x < 1 or x > 16 or y < 1 or y > 10 then return 0. return (y - 1) * 17 + x - (y - 1). END FUNCTION. FUNCTION XY2Cursor RETURNS INT(x as int, y as int): return (y - 1) * 17 + x. END FUNCTION. FUNCTION I2X RETURNS INT(i as int): return i mod 16. END FUNCTION. FUNCTION Get-Tile RETURNS INT (x as int, y as int): if XY2Index(x,y) = 0 then return ?. return tile[XY2Index(x,y)]. END FUNCTION. FUNCTION Get-Char RETURNS INT (x as int, y as int): if XY2Index(x,y) = 0 then return 0. return asc(substr(e,XY2Cursor(x,y),1)). END FUNCTION. FUNCTION Put-Tile RETURNS LOG (x as int, y as int, t as int, v as log): tile[XY2Index(x,y)] = t. if v then substr(e, XY2Cursor(x,y), 1) = chr(t). /*VISIVEL*/ END FUNCTION. FUNCTION Show-Tile RETURNS LOG (x as int, y as int): def var t as int. t = Get-Tile(x,y). if t = ? then return false. substr(e, XY2Cursor(x,y), 1) = chr(if t = 0 then 176 else t). disp e with frame tela. END FUNCTION. /* -------------------------------------------------------------------------- */ PROCEDURE Monta-Tabuleiro: def var i as int. def var x as int. def var y as int. assign e = '' tile = 0 qtd-bombas[1] = 12 qtd-bombas[2] = 0. do y = y to 9: e = e + fill(chr(178),16) + (if y < 9 then chr(10) else ''). end. do while i < qtd-bombas[1]: x = random(1,16). y = random(1,10). if Get-Tile(x,y) <> 0 then next. Put-Tile(x,y,235,false). i = i + 1. end. do y = 1 to 10: do x = 1 to 16: if Get-Tile(x,y) = 235 then next. i = 0. if Get-Tile(x, y - 1) = 235 then i = i + 1. if Get-Tile(x + 1, y - 1) = 235 then i = i + 1. if Get-Tile(x + 1, y) = 235 then i = i + 1. if Get-Tile(x + 1, y + 1) = 235 then i = i + 1. if Get-Tile(x, y + 1) = 235 then i = i + 1. if Get-Tile(x - 1, y + 1) = 235 then i = i + 1. if Get-Tile(x - 1, y) = 235 then i = i + 1. if Get-Tile(x - 1, y - 1) = 235 then i = i + 1. if i > 0 then Put-Tile(x,y,48 + i,false). end. end. run Refresh. tempo = time. END PROCEDURE. /* -------------------------------------------------------------------------- */ PROCEDURE Abre: def input param x as int. def input param y as int. if XY2Index(x,y) = 0 then return. Show-Tile(x,y). if Get-Tile(x,y) = 235 then run Game-Over(false). else if Get-Tile(x,y) = 0 then run Expande(x,y). e:cursor-char in frame tela = x. e:cursor-line = y. END PROCEDURE. /* -------------------------------------------------------------------------- */ PROCEDURE Marca: def input param x as int. def input param y as int. def var c as int. if XY2Index(x,y) = 0 then return. c = Get-Char(x,y). if c <> 178 and c <> 249 then return. if c = 178 and qtd-bombas[2] >= qtd-bombas[1] then do: message 'Voce ja marcou' qtd-bombas[2] skip 'Alguma esta incorreta.' view-as alert-box title ''. return. end. qtd-bombas[2] = qtd-bombas[2] + (if c = 178 then 1 else -1). substr(e,XY2Cursor(x,y),1) = chr(if c = 178 then 249 else 178). run Refresh. if qtd-bombas[2] = qtd-bombas[1] and Ganhou() then run Game-Over(true). END PROCEDURE. /* -------------------------------------------------------------------------- */ PROCEDURE Game-Over: def input param ganhou as log. def var x as int. def var y as int. do y = 1 to 10: do x = 1 to 16: Show-Tile(x,y). end. end. message (if ganhou then 'GANHOU!!! [' + substr(string(TIME - tempo,'HH:MM:SS'),4) + ']' else 'PERDEU!!!') view-as alert-box title ''. run Monta-Tabuleiro. END PROCEDURE. /* -------------------------------------------------------------------------- */ PROCEDURE Expande: def input param x as int. def input param y as int. def var t as int. def var ix as int. def var iy as int. Show-Tile(x,y). do iy = -1 to 1: do ix = -1 to 1: if iy = 0 and ix = 0 then next. t = Get-Tile(x + ix, y + iy). if t = ? then next. if Get-Char(x + ix, y + iy) <> 178 then next. if t = 0 then run Expande(x + ix, y + iy). else Show-Tile(x + ix, y + iy). end. end. END PROCEDURE. /* -------------------------------------------------------------------------- */ FUNCTION Ganhou RETURN LOG(): def var x as int. def var y as int. do y = 1 to 10: do x = 1 to 16: if Get-Tile(x,y) = 235 and Get-Char(x,y) <> 249 then return false. end. end. return true. END FUNCTION.