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
# potigol.github.io | |
# https://twitter.com/LucasTeles42/status/1514226905809100802 | |
buracos(entrada, saída: Lista[Caractere]): Texto = | |
se entrada.tamanho < 2 então | |
saída.inverta.junte("") | |
senãose entrada[2] - entrada[1] > 1 então | |
c = (entrada[1] + 1).caractere | |
buracos(c :: entrada.cauda, c :: saída) | |
senão |
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
defmodule Primality do | |
# O jeito "ingênuo" de checar por primalidade é você simplesmente verificar | |
# se o número tem divisores. Ou seja, você pega todos os números menores | |
# que o seu número-alvo (começando em 2, pois 1 divide todos os números) | |
# e verifica se eles dividem o número (ou seja, se o resto da divisão - | |
# função `rem/1` - é igual a 0). | |
# | |
# Também precisamos de um caso especial para 1, que não tem divisores mas não | |
# é primo. | |
def check_naive(1), do: false |
OlderNewer