summaryrefslogtreecommitdiff
path: root/tests/automata_text.c
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
committerepoch <epoch@hacking.allowed.org>2016-12-09 15:54:33 -0600
commitb4dddad64122649d9da6340032275d1756930e74 (patch)
treeafcfff52545fce1c7713f24e7a28904230fa8671 /tests/automata_text.c
parentfa1b447ef684e5eadda27d8870de6a6e09292a18 (diff)
downloadhackvr-b4dddad64122649d9da6340032275d1756930e74.tar.gz
hackvr-b4dddad64122649d9da6340032275d1756930e74.zip
LOTS OF SHIT
Diffstat (limited to 'tests/automata_text.c')
-rw-r--r--tests/automata_text.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/automata_text.c b/tests/automata_text.c
new file mode 100644
index 0000000..574c402
--- /dev/null
+++ b/tests/automata_text.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+
+#define HE he
+#define WI wi
+#define RULE rule
+
+
+int main(int argc,char *argv[]) {
+ int i,j;
+ int rule=atoi(argv[1]);
+ char str[256];//lel. close enough.
+ int wi=read(0,str,sizeof(str)-1)*8;
+ int he=atoi(argv[2]);
+ char f[HE+1][WI+1];
+ f[0][WI/2]=1;
+ for(i=0;i<HE;i++) {
+ for(j=0;j<WI;j++) {
+ if(i==0) f[i][j]=(str[j/8]>>(j%8))%2;
+ else f[i][j]=(RULE >> ((!!f[(i+HE-1)%HE][(j+WI-1)%WI]<<2) | (!!f[(i+HE-1)%HE][j]<<1) | (!!f[(i+HE-1)%HE][(j+1)%WI])) & 1);
+ }
+ }
+ for(i=0;i<HE;i++) {
+ for(j=0;j<WI;j++) {
+ if(f[i][j]) {
+ printf("%c",f[i][j]+'0');
+ } else {
+ printf(" ");
+ }
+ }
+ printf("\n");
+ }
+ return 0;
+}