Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cifra_correcta(f,c:INTEGER):BOOLEAN is
- local
- i,j:INTEGER
- do
- from i:=1
- until i>9 or Result=FALSE
- loop
- -- Comprueba repeticiones en la fila
- if (c+i <=9) then
- if (tablero.item(f,c).numero = tablero.item(f,c+i).numero) then Result:=FALSE end
- else
- if (tablero.item(f,c).numero = tablero.item(f,(c+i\\9)).numero) then Result:=FALSE end
- end
- -- Comprueba repeticiones en la columna
- if (f+i<=9) then
- if (tablero.item(f,c).numero = tablero.item(f+i,c).numero) then Result:=FALSE end
- else
- if (tablero.item(f,c).numero = tablero.item((f+i)\\9,c).numero) then Result:=FALSE end
- end
- end
- from i:=1
- until i>3
- loop
- from j:=1
- until j>3
- loop
- if (c+j)<=3 then
- if (tablero.item(f,c).numero = tablero.item((f+i),(j+i)).numero) then Result:=FALSE end
- else
- if (tablero.item(f,c).numero = tablero.item((f+i)\\3,(j+i)\\3).numero) then Result:=FALSE end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement