Skip to content

Instantly share code, notes, and snippets.

View nicolasfig's full-sized avatar
🧗
Focusing

Nicolas F nicolasfig

🧗
Focusing
View GitHub Profile
package recursion;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Recursion {
public static void pascalArray(int[][] matrix) {
@nicolasfig
nicolasfig / HelloPygame.py
Created October 17, 2012 02:33
Hello world and drawing some shapes using pygame
import pygame, sys
from pygame.locals import *
#Set up pygame
pygame.init()
#Set up the window
windowSurface = pygame.display.set_mode((500, 400), 0 , 32)
pygame.display.set_caption('Hello World')
@nicolasfig
nicolasfig / hangman.py
Created October 17, 2012 00:42
Hangman game using random and indexing
import random
HANGMANPICS = ['''
+---+
| |
|
|
|
|
=========''','''
@nicolasfig
nicolasfig / guessMyNumber.py
Created October 16, 2012 23:06
Guess my number simple text game
import random
guessesTaken = 0
print("Hello what is your name?")
name = input()
number = random.randint(1,20)
print("Well",name,",I am thinking of a number between 1 and 20.")
@nicolasfig
nicolasfig / beca.py
Created October 10, 2012 14:51
Patron singleton by Rafa.
class BecaEstudiante:
beca= None
cont= 0
@classmethod
def getBeca(cls,nombreBecado):
if cls.cont<5:
cls.cont+=1
cls.beca= BecaEstudiante()
@nicolasfig
nicolasfig / claseMatriz.py
Created October 9, 2012 16:41
python: Programa de matrices para pygroup
"""
Realizado por:
Rafael Baron Castro Cod: 20102020012
Nicolas Figueroa Beltran Cod: 20102020032
"""
class Matriz:
#constructor y atributos de la clase Matriz
def __init__(self, filas, columnas):
self.matriz=[]
@nicolasfig
nicolasfig / MatrixOp.py
Created October 7, 2012 03:26
python: Matrix operations using objecs "poorly structured"
#-------------------------------------------------------------------------------
# Name: Matrix
# Purpose:
#
# Author: Nicolas Figueroa
#
# Created: 06/10/2012
# Copyright: (c) Nicolas Figueroa 2012
#-------------------------------------------------------------------------------
import random
class Matriz:
def __init__(self, columnas, filas):
self.filas= filas
self.columnas= columnas
print("filas: ",filas,"columnas: ",columnas)
def llenarMattriz(self, filas, columnas):
@nicolasfig
nicolasfig / matrices.py
Created October 6, 2012 17:34
python: This file contains several matrix operations
#-------------------------------------------------------------------------------
# Name: Matrix
# Purpose:
#
# Author: Nicolas Figueroa
#
# Created: 06/10/2012
# Copyright: (c) Nicolas Figueroa 2012
#-------------------------------------------------------------------------------
import random
@nicolasfig
nicolasfig / euler.java
Created October 5, 2012 18:17
java: Calcula el numero euler basado en el factorial
public class Euler {
public static long fact(int x) {
long prod = 1;
for (int i = 1; i < x; i++) {
prod = prod * i;
}
return prod;
}
public static double euler(){