20 lines
418 B
C
20 lines
418 B
C
#include "stdio.h"
|
|
#include "dice.h"
|
|
#include "string.h"
|
|
#include "flags.h"
|
|
|
|
int run_interactive() {
|
|
int running = 1;
|
|
char buf[24];
|
|
while(running) {
|
|
printf("> ");
|
|
memset(buf,0,10);
|
|
scanf("%s",buf);
|
|
if(strcmp(buf,"quit")==0||strcmp(buf,"exit")==0||strcmp(buf,"q")==0) return 0;
|
|
process_dice_format(buf,&f_num,&f_die);
|
|
if(f_num!=0&&f_die!=0||buf[0]=='\0')
|
|
roll_and_print(f_num, f_die);
|
|
}
|
|
return 0;
|
|
}
|