-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdblist.cpp
49 lines (49 loc) · 1.11 KB
/
dblist.cpp
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
#ifdef USEDBLIFE
#include "lifealgo.h"
#include <algorithm>
#include <cstdlib>
using namespace std ;
extern "C" {
void tgrdb_setIncrement(int) ;
void tgrdb_init(const char *) ;
void tgrdb_setcell(int, int) ;
int tgrdb_nextstep() ;
int tgrdb_getpopulation() ;
} ;
class dblistalgo : public lifealgo {
public:
virtual void init(int w, int h) {
tgrdb_init("l") ;
}
virtual void setcell(int x, int y) {
tgrdb_setcell(x, y) ;
}
virtual int getpopulation() {
return tgrdb_getpopulation() ;
}
virtual int nextstep(int, int, int) {
return tgrdb_nextstep() ;
}
virtual int nextstep() {
return tgrdb_nextstep() ;
}
virtual void setinc(int inc) {
lifealgo::setinc(inc) ;
tgrdb_setIncrement(inc) ;
}
virtual void swap() {}
int w, h ;
long long wh ;
unsigned char *u0, *u1 ;
} ;
static class dblistalgofactory : public lifealgofactory {
public:
dblistalgofactory() ;
virtual lifealgo *createInstance() {
return new dblistalgo() ;
}
} factory ;
dblistalgofactory::dblistalgofactory() {
registerAlgo("dblist", &factory) ;
}
#endif