yOU GUYS ARE REAL HARDCORE TECHIES jAMAICAN GEEKS OF THE GEEKS
yOU GUYS ARE REAL HARDCORE TECHIES jAMAICAN GEEKS OF THE GEEKS
Last edited by LEON WILSON; Apr 4, 2005 at 12:25 AM.
//work from this and change wat u want yo. i cant give u mine but i worked //from this
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include <conio.h>
int random_1();
int main()
{
int i = 0;
int j = 0;
int check;
int check_1;
char play_again = '\n' ;
int tortoise[70];
int hare[70];
printf("BANG !!!!!\n");
printf("AND THEY'RE OFF !!!!!\n");
while(play_again == '\n')
{
while(i <= 69 && j <= 69)
{
tortoise[i] = 0;;
check = random_1();
if(check == 1 || check == 2 || check == 3 || check == 4 || check ==
5)
tortoise[i+=3] = 0;
if(check == 6 || check == 7)
tortoise[i-=6] = 0;
if(check == 8 || check == 9 || check == 10)
tortoise[i+=1] = 0;
char *ptr;
char line[71] = "-----------------------------------------------------------"
"-----------";
ptr = line;
if(i < 0){
i = 0;
*(ptr + i) = 'T';}
*(ptr + i) = 'T';
hare[j] = 0;
check_1 = random_1();
if(check_1 == 1 || check_1 == 2)
hare[j] = 0;
if(check_1 == 3 || check_1 == 4)
hare[j+=9] = 0;
if(check_1 == 5)
hare[j+=12] = 0;
if(check_1 == 6 || check_1 == 7 || check_1 == 8)
hare[j++] = 0;
if(check_1 == 9 || check_1 == 10)
hare[j-=2] = 0;
if(j < 0){
j = 0;
*(ptr + j) = 'H';}
*(ptr + j) = 'H';
if(i == j){
*(ptr + i) = 'O';
*(ptr + i + 1) = 'U';
*(ptr + i + 2) = 'C';
*(ptr + i + 3) = 'H';}
printf("%s\n\n", line);
break;
}
if(i >= 69)
{
printf("TORTOISE WINS!!! YAY!!!\n");
break;
}
if(j >= 69)
{
printf("HARE WINS. YUCH.\n");
break;
}
if(j >= 69 && i >= 69)
{
printf("IT'S A TIE\n");
break;
}
printf("Press enter");
scanf("%c", &play_again);
}
getch();
return 0;
}
int random_1()
{
srand(time(NULL));
return (1 + rand() % 10);
}
THANKS...oh my gosh i really appreciate it ....
***Note to the public***
Since ppl are a tad bit confused as to whether i happen to be male/female... i hope this will clear the air i am a FEMALE .. so stop wid da my ute/nigga/dog/man/boy beast ting!!
ive spoken
ATTENTION UTECH 1st year students....
The above code has been distributed to a lot of students.... Mr Pyne is no fool ... as we all know..lol... so it is advised that u change up some of the coding...
Last edited by Liquid Bunny; Apr 5, 2005 at 05:55 PM.
***Note to the public***
Since ppl are a tad bit confused as to whether i happen to be male/female... i hope this will clear the air i am a FEMALE .. so stop wid da my ute/nigga/dog/man/boy beast ting!!
ive spoken
LOL yes.. plagiarizing ppls code .
@ Liquid Bunny. I have a complete copy of the turtle graphics program. I'll upload it on Monday.
thanks... cant wait to see it
***Note to the public***
Since ppl are a tad bit confused as to whether i happen to be male/female... i hope this will clear the air i am a FEMALE .. so stop wid da my ute/nigga/dog/man/boy beast ting!!
ive spoken
Mr. psybuck2002us what ever became of this?
***Note to the public***
Since ppl are a tad bit confused as to whether i happen to be male/female... i hope this will clear the air i am a FEMALE .. so stop wid da my ute/nigga/dog/man/boy beast ting!!
ive spoken
OK, OK. I know i promised to upload this long ago, but i had my exams and last minute assignments killing me. This was my assignment for Turtle Graphics that i handed in when i was a first year at UTECH. Hope it's not too late to help you out. Anyway here goes......
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define up 0
#define down 1
#define north 4
#define south 5
#define east 6
#define west 7
#define row 20
#define col 20
int floor [row][col] = {0}, i, j, p, px = 0, py = 0, s, c, d, f;
char selection[20], e[20], n[20];
void choice (int);
void main()
{
printf("**************************************\n") ;
printf("* Welcome to Turtle Graphics *\n");
printf("**************************************\n") ;
again:
printf("\n============== MENU ==============\n");
printf("\n[1] Pen Off Canvas\n[2] Pen On Canvas\n[3] Turn Right\n[4] Turn Left\n[5] Turn Down\n[6] Turn Up\n[7] Move Pen\n[8] Display Canvas\n[9] Exit Turtle Graphics");
s = east; //Default Direction of the pen
p = up; //Default position of the pen; wether up or down
while (c != 9 || d == 2)
{
printf("\n\nSelection: ");
scanf("%s", selection);
c = atoi(selection); //Character Converted to Integar
/*This if structure was used to patch the problem where after the user enters 7 to move the pen, the menu is displayed
again before "Number of spaces to move forward" is displayed. The aim was to display the menu again only for all the other
options except 7. The problem is patched by telling the if statement to display the menu first, then continue to call the
function only when it is true that the value of "c" is not 7; else, if the value of "c" is 7, then the function is called immediately*/
if (c != 7) {
printf("\n============== MENU ==============\n");
printf("\n[1] Pen Off Canvas\n[2] Pen On Canvas\n[3] Turn Right\n[4] Turn Left\n[5] Turn Down\n[6] Turn Up\n[7] Move Pen\n[8] Display Canvas\n[9] Exit Turtle Graphics");
choice(c); //Call for function with the switch control structure
}
else {
if (c == 7)
choice(c); //Call for function with the switch control structure
}
}
printf ("\n[1] Yes\n[2] No\n\n");
printf ("Selection: ");
scanf ("%s", e);
d = atoi(e);
if (d == 1){
clrscr(); //Clears the screen
printf ("See You Later!!!\n");
}
else
if (d == 2)
goto again;
getch();
}
void choice (int)
{
switch(c)
{
case 1: //Pen Off Canvas
p = up;
break;
case 2: //Pen On Canvas
p = down;
break;
case 3: //Turn Right
if (s == north || s == south || s == east || s == west)
s = east;
break;
case 4: //Turn Left
if(s == north || s == south || s == east || s == west)
s = west;
break;
case 5: //Turn Down
if (s == north || s == south || s == east || s == west)
s = south;
break;
case 6: //Turn Up
if (s == north || s == south || s == east || s == west)
s = north;
break;
case 7: //Draw or Move Pen
printf("\nNumber of spaces to move forward: ");
scanf("%s", n);
f = atoi(n);
if (p == up) {
if(s == north)
{
for(i = 0; i < f; i++)
floor[px - i][py] = 0;
px = px - i + 1;
}
if(s == east)
{
for(i = 0; i < f; i++)
floor[px][py + i] = 0;
py = py + i - 1;
}
if(s == south)
{
for(i = 0; i < f; i++)
floor[px + i][py] = 0;
px = px + i - 1;
}
if(s == west)
{
for(i = 0; i < f; i++)
floor[px][py - i] = 0;
py = py - i + 1;
}
}
if (p == down) {
if(s == north)
{
for(i = 0; i < f; i++)
floor[px - i][py] = 1;
px = px - i + 1;
}
if(s == east)
{
for(i = 0; i < f; i++)
floor[px][py + i] = 1;
py = py + i - 1;
}
if(s == south)
{
for(i = 0; i < f; i++)
floor[px + i][py] = 1;
px = px + i - 1;
}
if(s == west)
{
for(i = 0; i < f; i++)
floor[px][py - i] = 1;
py = py - i + 1;
}
}
break;
case 8: //Display Canvas (20 x 20 Array)
clrscr();
printf("\n");
for(i = 0; i < row; i++)
{
for(j = 0; j < col; j++)
{
if (floor[i][j] == 0)
printf(". ");
if (floor[i][j] == 1)
printf("* ");
}
printf("\n");
}
break;
case 9: //Exit Program
clrscr();
printf ("Are you sure you want to exit?\n");
break;
default:
printf ("\nInvalid Input\n");
break;
}
}
Last edited by psybuck2002us; May 11, 2005 at 07:50 PM.
better late than never, i suppose... thanks Psy
***Note to the public***
Since ppl are a tad bit confused as to whether i happen to be male/female... i hope this will clear the air i am a FEMALE .. so stop wid da my ute/nigga/dog/man/boy beast ting!!
ive spoken