para i de 100 até 200 passo 10 faça
escreva i
fim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imprimir posição e valor | |
lista = ["TADS", "IFRN", "Natal"] | |
para i de 1 até lista.tamanho faça | |
nome = lista[i] | |
escreva "{i} - {nome}" | |
fim |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mapa = Matriz.mutavel(12,12," ") | |
PAREDE = "▓" | |
JOGADOR = "♞" | |
var x := 3 | |
var y := 11 | |
montar_mapa() | |
para i de 1 até 12 faça | |
mapa[i][1] := PAREDE | |
mapa[i][12] := PAREDE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tipo Dado | |
lados: Inteiro | |
var valor = aleatório(1, lados) | |
rolar() | |
valor := aleatório(1, lados) | |
fim | |
fim | |
d1 = Dado(6) | |
escreva d1.valor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use "ponto.poti" | |
use "IA.poti" | |
largura = 15 | |
altura = 15 | |
inicio = Ponto(3,3) | |
final = Ponto(8,9) | |
barreiras = [Ponto(3,5), Ponto(4,4), Ponto(4,3), Ponto(3,6)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
para i de 1 até 10 faça | |
escreva i | |
fim | |
var i := 1 | |
var stop := falso | |
enquanto i <= 10 e não stop faça | |
escreva i | |
i := i + 1 | |
se i > 5 então |
Uma forma de tornar mais rápida a execução de programas em Potigol é transcrever os programas para a lingaugem Scala e em seguida realizar a compilação.
Faça o download da linguagem Potigol (https://github.com/potigol/Potigol/releases/download/0.9.13/potigol.zip) e descompacte. Copie os arquivos deste gist para a pasta do Potigol.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use "jerimum" | |
largura = jogo.largura div 20 | |
altura = jogo.altura div 20 | |
img_fundo = Imagem("grama.jpg") | |
img_cobra = Imagem("cobra.png") | |
img_comida = Imagem("comida.png") | |
cobra_x = largura div 4 | |
cobra_y = altura div 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Texto | |
a = "IFRN" | |
b = "TADS" | |
c = a + b # "IFRNTADS" | |
d = a * 2 # "IFRNIFRN" | |
x = 10 | |
escreva "Alagoas {x}." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usando a linguagem Potigol: potigol.github.io | |
palindromos(min, max: Inteiro) = | |
para i de min até max se i.texto == i.texto.inverta gere i fim | |
testes = [(0, 20), (3000, 3010), (0, 1000), (1000, 2000), (2000, 3000)] | |
para teste em testes faça | |
min, max = teste.primeiro, teste.segundo | |
escreva "{min} - {max}: {palindromos(min, max).junte(", ")} | |
|==========" |