diff --git a/demos/rd6.c b/demos/rd6.c new file mode 100644 index 0000000..2d7beee --- /dev/null +++ b/demos/rd6.c @@ -0,0 +1,53 @@ +/* rd6 - Roll X number of 6 sided dice. Perfect for the board game Axis and Allies. +Copyright (C) 2003 Shaun Marquardt + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +#include +#include +#include +#include +#include "random.h" + +void main() +{ + for(;;) + { + int number = 0, numdice = 0, count = 0, col = 0; + char tmp[3]; + + printf("\nHow many 6 sided dice do you wish to roll? "); + numdice = atoi(gets(tmp)); + + if( (numdice<1) || (numdice>100) ) + { + printf("Please enter an number between 1 and 100.\n"); + main(); + } + + seedrnd(); + + for(count=0;count