Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i`m working on program, well it`s a game really, it`s call AZAR this game have to generate number between 1 to 6 just like a cast. Each player(dicer) have the chance to cast until they reach 15 point or higher whoever reach that score win the game.
help!!!!!!
pd sorry about my english grammar
by the way only 4 player can play that game

To start out mabee experiment with the "random()" function.
// sample program to generate random numbers
#include"stdio.h"
#include"stdlib.h"void main()
{
char ch = 0, j, sum = 0;
printf("Press 'c' to cast the dice \n 'q' to quit:\n\n");
randomize();
do
{
ch = getch();
j = random(6) + 1;
sum += j;
printf("You cast: %d\nYour total: %d\n\n", j, sum);
}
while(ch == 'c');
}

thx dude..... but i have some question here, you use lettle c for what in this line while(ch==c).... because that`c` hasn`t been declare as variable...

'c' is a constant because it is enclosed in single quotes.
ch == 'c'
checks the variable "ch" with the logical operator == to see if the character constant 'c' or 0x63 has been entered.good luck on your program.

hey bob i really appreciate your help however i need more help dude.... i`m getting crazy..... i`m using turbo c 2.0 and i`m getting 2 errors on the program, the first one is about the while line it said undefined symbol c in function main and the second one is "declaration syntax error in function main"....

Perhaps you need the "time.h" library for the random() function. Also "conio.h" if getch() does not function. Since you have an older version of C compiler than mine(i use 3.0) than mabee you need these. Also make sure you have single quotes around the c variabe.
while(ch == 'c');

hai yez plz linux help. yez!!!!
hai, my english good. hai
yes plz.whatis troll?
lunix is sux!!lunix is sux!!lunix is sux!!lunix is sux!!lunix is sux!!
lunix is sux!!lunix is sux!!lunlunix is sux!!lunix is sux!!ix is sux!!lunix is sux!!lunix is sux!!lunix is sux!!
lunix is sux!!lunix is sux!!lunix is sux!!
--- ack!
india 0wnz j00's ch4t roomz.

hey guys HAPPY NEW YEAR!!!!!!!!!!!!
hey bob do u think that the function void is stand on this version of turbo c?....
i think i`m having problem with that dude `cause i get every time DECLARATION SYNTAX ERROR IN FUNCTION MAIN......

Ya mabee put:
int main()at the beginning and:
return 0;at the end, then try it.
Check your email for the program.

thx dude!!!!!!
hey bob can u hook me up with a link to download turbo c 3.0, i got a version of it but it doesn´t work well.....
turbo c pops a problem everytime i run it on my pc, i´m using win98 second editioni dunno what happened

You can download Borland's C++ 5.5 compiler from the Borland web site here:
http://www.borland.com/bcppbuilder/freecompiler/cppc55steps.html

Add some spice to your dice!!
Here's a neat little graphic that runs in Dos#include
#include
#include
#include
#define BORD 0x0600
#define DOT 0x0F00
#define NORMAL 0x0700
union REGS regs;
int far *farptr;
int dot_1 = 1136;
int dot_2[] = { 972, 1300 };
int dot_3[] = { 972, 1136, 1300 };
int dot_4[] = { 972, 980, 1292, 1300 };
int dot_5[] = { 972, 980, 1136, 1292, 1300 };
int dot_6[] = { 972, 980, 1132, 1140, 1292, 1300 };
void clrs()
{
int charac;
for(charac = 0; charac < 2000; charac++)
*(farptr + charac) = NORMAL;
regs.h.ah = 2;
regs.x.dx = 0;
int86(0x10, ®s, ®s);
}
void outline(int blink)
{
int j, k;
for(k = 880; k <= 1360; k += 480)
for(j = 11; j <= 22; j++) {
*(farptr + k + j) = BORD ^ blink | 205;
*(farptr + k + j + 22) = BORD ^ blink | 205;
}
for(k = 10; k <= 23; k += 13)
for(j = 960; j <=1280; j += 80) {
*(farptr + k + j) = BORD ^ blink | 186;
*(farptr + k + j + 22) = BORD ^ blink | 186;
}
*(farptr + 890) = BORD ^ blink | 201;
*(farptr + 912) = BORD ^ blink | 201;
*(farptr + 903) = BORD ^ blink | 187;
*(farptr + 925) = BORD ^ blink | 187;
*(farptr + 1370) = BORD ^ blink | 200;
*(farptr + 1392) = BORD ^ blink | 200;
*(farptr + 1383) = BORD ^ blink | 188;
*(farptr + 1405) = BORD ^ blink | 188;
}
void plotdot(cast, face, n)
int cast, *face, n;
{
int x = 0;
do {
*(farptr + *face + 22 * n) = DOT | 219;
*(farptr + *(face++) + 1 + 22 * n) = DOT | 219;
}
while(x++ < cast);
}
void condns(int die, int n)
{
switch(die) {
case 1:
plotdot(0, &dot_1, n); break;
case 2:
plotdot(1, &dot_2, n); break;
case 3:
plotdot(2, &dot_3, n); break;
case 4:
plotdot(3, &dot_4, n); break;
case 5:
plotdot(4, &dot_5, n); break;
case 6:
plotdot(5, &dot_6, n); break;
default:
exit(0);
}
}
int main()
{
int die_1, die_2, cast_1, cast_2, t;
farptr = (int far *) 0xB8000000;
clrs();
randomize();
while(1) {
printf("Enter two numbers(1 - 6)\n");
printf("Hit 8 to quit: ");
scanf("%d %d", &die_1, &die_2);
if(die_1 == 8 || die_2 == 8)
exit(0);
for(t = 0; t < 10; t++) {
cast_1 = random(6) + 1;
cast_2 = random(6) + 1;
clrs();
outline(0x8000);
condns(cast_1, 0);
condns(cast_2, 1);
delay(200);
}
clrs();
outline(0);
condns(die_1, 0);
condns(die_2, 1);
}
}

AAAAAAAAH!! This dumb HTML!
The 4 includes are:
stdio.h
stdlib.h
dos.h
time.h
and the line int 86(0x10, ®s, ®s)
the ®s is an ampersand preceding"regs"

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |