This file contains 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
##Calculadora humana. Por knkillname. | |
##¡Diviértete! | |
from random import choice, randint | |
L = ['+', '-', '×', '/'] | |
while True: | |
op = choice(L) | |
if op == '+': | |
res = randint(1, 99) | |
a = randint(0, res) |
This file contains 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
## Algoritmos de caminos más cortos | |
from estructuras import Cola, ColaMin | |
from conectividad import ordenamiento_topologico | |
inf = float('inf') #Tratar infinito como un numero | |
def recorrido_a_lo_ancho(G, s): | |
dist, padre = {v:inf for v in G}, {v:v for v in G} | |
dist[s] = 0 |
This file contains 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
# This program prints all the programs that can be written in Python | |
# (even this very same program if you give it enough time) | |
import string | |
def generate_programs(alphabet = string.printable): | |
alphabet = tuple(alphabet) | |
word, m, n = [], 0, len(alphabet) | |
while True: | |
p = ''.join(alphabet[i] for i in word) |
This file contains 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
import ast | |
## ESTRUCTURA DE DATOS PARA ALMACENAR UN CIRCUITO BOOLEANO | |
class Nodo: | |
__slots__ = 'etiqueta', 'hijos' | |
def __init__(self, etiqueta, *hijos): | |
self.etiqueta = etiqueta | |
self.hijos = hijos |
This file contains 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
## Author: Mario Abarca (knkillname) | |
## Email: asma@uaem.mx | |
## Date: 25 Feb 2015 | |
## Language: Python 3 | |
## | |
## Summary: A class representing bigraph objects given by a quasi-Cartan | |
## Matrix. Includes elementary operations, csv formating, and ploting. | |
from array import array | |
from os.path import splitext |
This file contains 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
## Algoritmos en redes (grafos con pesos en las aristas) | |
## | |
## Autor: Mario Abarca (asma@uaem.mx) | |
## Fecha: 20 de octubre de 2015 | |
from grafos import Grafo | |
from estructuras import Cola | |
from estructuras import ColaMin | |
from estructuras import ConjuntosDisjuntos |
This file contains 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
import turtle, colorsys, math | |
t = turtle.Turtle() | |
t.pensize(4); t.right(90); t.speed(0) | |
n, j, i, p = 19, 1, 1, (5 ** 0.5 - 1) / 2 | |
for k in range(n): | |
r, g, b = colorsys.hls_to_rgb(p * k % 1, p, 1) | |
t.color('white', (r, g, b)) | |
t.begin_fill() | |
for k in range(4): |
This file contains 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
## A simple program that showcases tree drawing by fractals | |
## Copyright (C) 2016 Mario Abarca | |
## | |
## This program is free software: you can redistribute it and/or | |
## modify it under the terms of the GNU General Public License as | |
## published by the Free Software Foundation, either version 3 of the | |
## License, or (at your option) any later version. | |
## | |
## This program is distributed in the hope that it will be useful, | |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains 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
# Crear un laberinto aleatorio en Python3 usando el algoritmo de | |
# recorrido en profundidad. El propósito de este programa es mostrar las | |
# características del lenguaje. | |
# | |
# Autor: Mario Abarca | |
# Fecha: 2017/09/07 | |
from random import shuffle, randint # Números pseudoaleatorios | |
from itertools import product # Producto cartesiano |
This file contains 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
# Autor: Mario Abarca | |
# Fecha: 29 nov. 2017 | |
# Lenguaje: Python 3.6 | |
from cmd import Cmd | |
class TextoBinarioApp(Cmd): | |
def __init__(mi): | |
super().__init__() | |
mi.codigo = 'utf8' |
OlderNewer