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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
type Individual struct { | |
queens []int |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"os" | |
"strconv" | |
"time" | |
) |
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
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 |
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
package genemath | |
import ( | |
"math/rand" | |
"github.com/eltrufas/genetic" | |
) | |
const ( | |
// MINIMIZE means we're maximizing the algo |
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
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, |
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:
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
(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 |
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 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(',') |