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
/* | |
* Practicing genetic algoritms | |
* Daniel Mateos | |
* Problem: find an equation out of 0-9 *+/- that comes up with 42 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define GENES 32 |
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
/* | |
* Practicing genetic algoritms | |
* Daniel Mateos | |
* Problem: find an equation out of 0-9 *+/- that comes up with 42 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <math.h> |
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
daniel@hammerhead:~/Documents/code/scratch/chromnum$ ./a.out | |
CHROMOSOME 1/16 fitness: 0.100000 | |
1010(10) 0100(4) 0111(7) 0110(6) 0001(1) 0111(7) 1011(11) 0100(4) 0111(7) 1000(8) | |
+ 4 - 4 | |
0/10 | |
CHROMOSOME 2/16 fitness: 0.200000 | |
1001(9) 1100(12) 1111(15) 0100(4) 1010(10) 1011(11) 1110(14) 0101(5) 0001(1) 1111(15) | |
* 4 + 5 | |
5/10 | |
CHROMOSOME 3/16 fitness: 0.200000 |
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
%{ | |
#include <stdio.h> | |
%} | |
%option noyywrap | |
%% | |
[0-9]+ { | |
printf("Integer %s\n", yytext); |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <fcntl.h> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "sockio.h" | |
#include <unistd.h> | |
void handle_connection(int sd) { | |
printf("new connection from %d\n", sd); | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "sockio.h" | |
#include <unistd.h> | |
void handle_connection(int sd) { | |
printf("new connection from %d\n", sd); | |
} |
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
require 'rubygems' | |
require 'em-websocket' | |
clients = {} | |
EventMachine::WebSocket.start(:host => "localhost", :port =>8080) do |socket| | |
puts "new connection" | |
socket.onopen do | |
socket.send "hello client" |
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
<html> | |
<script type="text/javascript" | |
src="http://code.jquery.com/jquery-latest.pack.js"> | |
</script> | |
<script> | |
$(document).ready(function() { | |
function debug(str) { | |
$("#debug").append(str + "<br/>"); | |
}; |
OlderNewer