Skip to content

samTime101/ASCII-Dice-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII Based Dice Game in C

Created a Gambling type Dice game in C. Its CLI based game with some colors not really interesting but it was fun creating it

Headerfiles

  • stdlib
  • Unistd
  • stdio
  • random.h
  • structures.h

random.c

The random number function , although there is a builtin random function in C but it required some tweaking so i made it into a seperate function

#include<stdlib.h>
#include "random.h"

int _random(int max,int min){
    //rand() % (max_number + 1 - minimum_number) + minimum_number
    return rand() % (max + 1 - min) + min;
}

ESCAPE CODES

I also used some ANSI escape codes , REFERENCE

ESCAPE CHARACTER CODE
RED \x1b[38;5;196m
GREEN \x1b[38;5;46m
BLUE \x1b[38;5;33m
DEFAULT \x1b[1;39m

COMPILATION

clone the repo and run

make to compile , the output shall be in output folder

To clean type: make clean

About

A simple ASCII dice game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published