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
| #!/usr/bin/env python | |
| ''' list median words shorter than a certain length | |
| cf. Chapter 3.3 of ``Elementary Symbolic Dynamics'' B-l, Hao ''' | |
| def ncom(a, b): | |
| ''' length of the common leading part of two given words ''' | |
| n = min(len(a), len(b)) | |
| for i in range(n): | |
| if a[i] != b[i]: return i |
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
| /* | |
| * http://www.beyond3d.com/content/articles/8/ | |
| * http://www.beyond3d.com/content/articles/15/ | |
| */ | |
| #include <stdio.h> | |
| #include <math.h> | |
| float inv_sqrt(float x) | |
| { | |
| float xh = 0.5f*x; |
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 <string.h> | |
| #define N 20 /* max length of expression >= 2*ncard = 8 */ | |
| #define MAXDIG 10 /* max digit: note the digit should less than 42 */ | |
| int ncard = 4; /* number of cards */ | |
| double target = 24; /* target number */ | |
| #define zero(x) ((x) < 1e-5 && (x) > -1e-5) | |
| #define clear(a) memset(a, 0, sizeof(a)) |
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
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" > | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
| <title>Lights out</title> | |
| <style type="text/css"> | |
| /*<![CDATA[*/ | |
| body { | |
| font: 90% "MS Trebunchet", "Lucida Grande", 'Verdana', 'Tahoma', 'Calibri', sans-serif; | |
| width: 600px; |
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> | |
| typedef unsigned char BYTE; /* one byte (0-255) */ | |
| typedef unsigned short WORD; /* two bytes */ | |
| typedef unsigned int DWORD; /* four bytes */ | |
| /* Bitmap format cf. | |
| * http://en.wikipedia.org/wiki/BMP_file_format |
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> | |
| typedef struct { | |
| int n; /* number of integers */ | |
| int m; /* current number of bits */ | |
| int top; /* current top */ | |
| int *st; /* current stack */ |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script> | |
| function mcgetPi() { | |
| var c = document.getElementById("mcpi"); | |
| var ctx = c.getContext("2d"); | |
| var w = c.width; | |
| var h = c.height; | |
| var r = Math.min(w/2, h/2) - 1; |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| body { | |
| font: 90% "MS Trebunchet", "Lucida Grande", 'Verdana', 'Tahoma', 'Calibri', sans-serif; | |
| width: 600px; | |
| margin: auto; | |
| } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
| <title>Lennard-Jones equation of state</title> | |
| <script type="text/javascript" src="dygraph-combined.js"></script> | |
| <script type="text/javascript"> | |
| //<![CDATA[ | |
| /* compute reference thermal dynamics variables |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style type="text/css"> | |
| .score_table { | |
| background-color: #ffffd0; | |
| font-family: "Courier New", monospace; | |
| border-collapse: collapse; | |
| border: 5px #ffffff groove; | |
| } |