Hi, I wrote a FOSS D&D dice rolling program

Raj J Putari jmaharaj2013 at gmail.com
Sat Oct 3 22:19:31 UTC 2020


Hopefully I don’t get flamed, I’d post it to USENET but I don’t have EasyNews posting access

You can do whatever you want with it, but I strongly suggest contacting your DM

(Attached is the source, I’ll paste it for the security conscience)

// START

//

//  main.c

//  DUNGEONS_AND_DRAGONS_DICE

//

//  Created by unidef on 10/3/20.

//



#include <stdio.h>

#include <stdlib.h>

#include <time.h>

#include <string.h>

#include <unistd.h>



#define NUMBER_OF_ROLLS 1

#define NUMBER_OF_SIDES 12;



short PauseTime = 3; // seconds

typedef double long int64;





struct Dice {

    int Sides;

    char description[700];

    short Dungeon_Code;



    /* dungeon code

     0 for monster

     1 for player

     2 for dungeon master

     */

};



struct Dice Roll(int Dice_Sides){



    struct Dice Roll;

    int rRandSeed;

    time_t CurrentTime;



    Roll.Sides = Dice_Sides;

    time(&CurrentTime);

    rRandSeed = (int)rand() % Roll.Sides;

    strcat(Roll.description, "Rolled at ");

    strcat(Roll.description, ctime(&CurrentTime));

    printf("Rolled %d at %s", rRandSeed, ctime(&CurrentTime));

    sleep(PauseTime);

    return(Roll);

}



void Mean_System(){

    // Mean system denotes estimation based on Dungeon_Code

    // TODO

};







int main(int argc, const char * argv[]) {

    struct Dice Holder;



    int Counter = 0;

    int NumberOfRolls = NUMBER_OF_ROLLS;

    int DiceSides = NUMBER_OF_SIDES;



    while (Counter < NumberOfRolls){

        Holder = Roll(DiceSides);

        Counter++;

    }



    printf("Done! Please consult Dungeon Master\n");



    return 0;

}

// END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: application/octet-stream
Size: 1328 bytes
Desc: main.c
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20201003/d238d59b/attachment.obj>


More information about the freebsd-hackers mailing list