forked from simsim314/LifeAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLifeAPISample4.c
More file actions
51 lines (37 loc) · 973 Bytes
/
LifeAPISample4.c
File metadata and controls
51 lines (37 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "LifeAPI.h"
int main()
{
New();
LifeState* pat = NewState("obo$b2o$bo9$4bo$4b2o$3bobo$7b3o$7bo$8bo$14bo$13b2o$13bobo!", 0, -20);
LifeState* target = NewState("$b2ob2o$bo3bo$2bobo$b2ob2o3$3bo$2bobo$3bo!", 2, -10);
LifeState* inverse = NewState("7o$o2bo2bo$ob3obo$2obob2o$o2bo2bo$7o$7o$3ob3o$2obob2o$3ob3o$7o!", 2, -10);
LifeTarget * fulltarget = NewTarget(target, inverse);
LifeState* gld = NewState("b2o$obo$2bo!", 0, 0);
LifeIterator *iter1 = NewIterator(gld, -21, -5, 30, 30);
LifeIterator *iter2 = NewIterator(gld, -21, -5, 30, 30);
do
{
New();
PutState(pat);
PutState(iter1);
PutState(iter2);
Print();
getch();
Run(100);
if(ContainsTarget(fulltarget) == YES)
{
New();
PutState(pat);
PutState(iter1);
PutState(iter2);
PrintRLE();
Print();
Run(100);
Print();
getch();
printf("\Searching");
}
}while(Next(iter1, iter2) == SUCCESS);
printf("\nFinished");
getch();
}