Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafael Castillo eltrufas

View GitHub Profile
@eltrufas
eltrufas / adv3.py
Created Dec 3, 2018
advent of code day 3
View adv3.py
import sys
lines = list(sys.stdin)
ss = [l.split(" ") for l in lines]
rects = []
for s in ss:
print(s)
x, y = s[2][:-1].split(',')
View rsa.lisp
(defun randn (s n)
"Regresa un numero aleatorio en [s, n)"
(+ s (random (- n s))))
(defun mod-exp (base exponent modulus)
"Calcula el exponente modular"
(cond ((zerop exponent) 1)
((evenp exponent) (mod-exp (mod (* base base) modulus)
(truncate exponent 2) modulus))
((oddp exponent) (mod (* base (mod-exp base
View keybase.md

Keybase proof

I hereby claim:

  • I am eltrufas on github.
  • I am rafaelc (https://keybase.io/rafaelc) on keybase.
  • I have a public key ASCDUZGMuDzzc8utjT9tBvmg_7D0MGU0SUixw8jTDYUgnwo

To claim this, I am signing this object:

View trotation.go
var IStates [4][16]int = [4][16]int{
{
0, 0, 0, 0,
1, 1, 1, 1,
0, 0, 0, 0,
0, 0, 0, 0,
},
{
0, 0, 1, 0,
0, 0, 1, 0,
@eltrufas
eltrufas / go.md
Created Jan 25, 2018
Recursos para aprender Go
View genemath.go
package genemath
import (
"math/rand"
"github.com/eltrufas/genetic"
)
const (
// MINIMIZE means we're maximizing the algo
View genetic.go
package genetic
import "math/rand"
// Individual representa las caracteristicas de un individuo de una poblacion
type Individual interface {
Crossover(Individual) (Individual, Individual)
Mutate() Individual
Fitness() float32
Copy() Individual
View n_queens.go
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"time"
)
@eltrufas
eltrufas / n-queens.go
Last active Feb 8, 2017
Solution to the n queen problem in go using genetic algorithms. Includes a solution with and without using goroutines
View n-queens.go
package main
import (
"fmt"
"math/rand"
"time"
)
type Individual struct {
queens []int
You can’t perform that action at this time.