Pythonify run_size(); add void set_size(int size)

This commit is contained in:
Samuel Sloniker 2021-08-18 13:48:45 -07:00
parent 8f500085dc
commit 1772e8df6d
2 changed files with 6 additions and 5 deletions

5
worm.c
View File

@ -87,7 +87,7 @@ char outbuf[BUFSIZ];
void crash(void) __attribute__((__noreturn__));
void display(const struct body *, char);
int run_size(int);
void set_size(int);
int run_worm();
void leave(int) __attribute__((__noreturn__));
void life(void);
@ -98,9 +98,8 @@ int rnd(int);
void setup(void);
void wake(int);
int run_size(int sl) {
void set_size(int sl) {
start_len = sl;
run_worm();
}
int run_worm() {

View File

@ -4,6 +4,8 @@ import sys
worm = ctypes.cdll.LoadLibrary('./libworm.so')
if len(sys.argv) == 2:
worm.run_size(int(sys.argv[1]))
worm.set_size(int(sys.argv[1]))
else:
worm.run_size(10)
worm.set_size(7)
worm.run_worm()