Pythonify run_size(); add void set_size(int size)
This commit is contained in:
parent
8f500085dc
commit
1772e8df6d
5
worm.c
5
worm.c
|
@ -87,7 +87,7 @@ char outbuf[BUFSIZ];
|
||||||
|
|
||||||
void crash(void) __attribute__((__noreturn__));
|
void crash(void) __attribute__((__noreturn__));
|
||||||
void display(const struct body *, char);
|
void display(const struct body *, char);
|
||||||
int run_size(int);
|
void set_size(int);
|
||||||
int run_worm();
|
int run_worm();
|
||||||
void leave(int) __attribute__((__noreturn__));
|
void leave(int) __attribute__((__noreturn__));
|
||||||
void life(void);
|
void life(void);
|
||||||
|
@ -98,9 +98,8 @@ int rnd(int);
|
||||||
void setup(void);
|
void setup(void);
|
||||||
void wake(int);
|
void wake(int);
|
||||||
|
|
||||||
int run_size(int sl) {
|
void set_size(int sl) {
|
||||||
start_len = sl;
|
start_len = sl;
|
||||||
run_worm();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int run_worm() {
|
int run_worm() {
|
||||||
|
|
6
worm.py
6
worm.py
|
@ -4,6 +4,8 @@ import sys
|
||||||
worm = ctypes.cdll.LoadLibrary('./libworm.so')
|
worm = ctypes.cdll.LoadLibrary('./libworm.so')
|
||||||
|
|
||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
worm.run_size(int(sys.argv[1]))
|
worm.set_size(int(sys.argv[1]))
|
||||||
else:
|
else:
|
||||||
worm.run_size(10)
|
worm.set_size(7)
|
||||||
|
|
||||||
|
worm.run_worm()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user