PrateekSaxena
-
Posts
584 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by PrateekSaxena
-
-
Yes that is what I mean!You mean I do not need to type localhost/mySubDomain/tableNameA friend told me to do this and it was not working
-
Hello,I currently have an AwardSpace free account that allows me to create one Database with some tables. But I do not know ow my PHP can connect with that database, I mean I don't know what to type in the location. does anyone else use AwardSpace and can solve this problem?
-
How about iMDead??
-
Ok...the CMS as far as I saw was really nice, make a nice template for yourself something like this - http://sourceforge.net/dbimage.php?id=114616I made this sample template for the CMS I am working on, LaunchPad CMS!!
-
Warning: mysql_connect() [function.mysql-connect]: User '16592' has exceeded the 'max_connections_per_hour' resource (current value: 1500) in /var/www/hotserv.dk/users/andersmoen/cms/config/db.php on line 2Could not connect: User '16592' has exceeded the 'max_connections_per_hour' resource (current value: 1500)I am getting this error now
-
how do i get a username and stuff??
-
Why is this coming on the runescape page??
<body bgcolor="red">
??Also how can a person add comments??
-
This is a hangman that has sort of an AI and it learns as it plays with you --
#include<fstream.h>#include<conio.h>#include <graphics.h>#include <stdlib.h>struct game_data{int who[10];int where[10];};int winc=1,losec=1,tiec=1;game_data current;game_data win[100];game_data lose[100];game_data tie[100];int game=1;void chck(int c1,int c2,int c3,int c4,int c5,int c6,int c7,int c8,int c9,int who){ if((c1==1 && c2==1 && c3==1)||(c4==1 && c5==1 && c6==1)||(c7==1 && c8==1 && c9==1)||(c1==1 && c4==1 && c7==1)||(c2==1 && c5==1 && c8==1)||(c3==1 && c6==1 && c9==1)||(c1==1 && c5==1 && c9==1)||(c3==1 && c5==1 && c7==1)){ gotoxy(30,1); if (who==1){ cout<<"X has won!"; lose[losec]=current; losec++; }else{ cout<<"The human has won"; lose[losec]=current; losec++; } c1=0; game=0; } if((c1==2 && c2==2 && c3==2)||(c4==2 && c5==2 && c6==2)||(c7==2 && c8==2 && c9==2)||(c1==2 && c4==2 && c7==2)||(c2==2 && c5==2 && c8==2)||(c3==2 && c6==2 && c9==2)||(c1==2 && c5==2 && c9==2)||(c3==2 && c5==2 && c7==2)){ gotoxy(30,1); if(who==1){ cout<<"O has won!"; win[winc]=current; winc++; }else{ cout<<"The computer has won!"; win[winc]=current; winc++; } c1=0; game=0; } if (c1!=0 && c2!=0 && c3 !=0 && c4!=0 && c5!=0 && c6!=0 && c7!=0 && c8!=0 && c9!=0){ gotoxy(30,1); cout<<"Cat's game"; tie[tiec]=current; tiec++; game=0; }}void makeboard(){ setcolor(BLUE); rectangle(1,1,100,100);//1 rectangle(100,1,200,100);//2 rectangle(200,1,300,100);//3 rectangle(1,100,100,200);//4 rectangle(100,100,200,200);//5 rectangle(200,100,300,200);//6 rectangle(1,200,100,300);//7 rectangle(100,200,200,300);//8 rectangle(200,200,300,300);//9}void x(int pos){ setcolor(RED); switch(pos){ case 1: line(10,10,90,90); line(90,10,10,90); break; case 2: line(110,10,190,90); line(190,10,110,90); break; case 3: line(210,10,290,90); line(210,90,290,10); break; case 4: line(10,110,90,190); line(90,110,10,190); break; case 5: line(110,110,190,190); line(110,190,190,110); break; case 6: line(210,110,290,190); line(210,190,290,110); break; case 7: line(10,210,90,290); line(10,290,90,210); break; case 8: line(110,210,190,290); line(110,290,190,210); break; case 9: line(210,210,290,290); line(210,290,290,210); }}void o(int pos){ switch(pos){ case 1: setcolor(RED); circle(50,50,40); break; case 2: setcolor(RED); circle(150,50,40); break; case 3: setcolor(RED); circle(250,50,40); break; case 4: setcolor(RED); circle(50,150,40); break; case 5: setcolor(RED); circle(150,150,40); break; case 6: setcolor(RED); circle(250,150,40); break; case 7: setcolor(RED); circle(50,250,40); break; case 8: setcolor(RED); circle(150,250,40); break; case 9: setcolor(RED); circle(250,250,40); break; }}void ps(int pos){ setcolor(WHITE); switch(pos){ case 1 : rectangle(1,1,100,100); break; case 2: rectangle(100,1,200,100); break; case 3: rectangle(200,1,300,100); break; case 4: rectangle(1,100,100,200); break; case 5: rectangle(100,100,200,200); break; case 6: rectangle(200,100,300,200); break; case 7: rectangle(1,200,100,300); break; case 8: rectangle(100,200,200,300); break; case 9: rectangle(200,200,300,300); break; }}void playone(){ setfillstyle(1,BLACK); bar(0,0,700,700); makeboard(); int ch=1,temp=0; char ans; game=1; int y,pos=1; int chnc=1; int taken[19]={0,0,0,0,0,0,0,0,0,0,0,0,0}; while (y!=27 && game==1){ if (chnc%2==0){ ans=getch(); y=ans; } switch(y){ case 72: if(pos!=1 && pos!=2 && pos!=3){ pos=pos-3; } break; case 80: if(pos!=7 && pos!=8 && pos!=9){ pos=pos+3; } break; case 77: if (pos!=9){ pos++; } break; case 75: if (pos!=1){ pos--; } break; case 32: if ( taken[pos]!=1 && taken[pos]!=2 && chnc%2==0){ x(pos); taken[pos]=1; current.who[chnc]=1; current.where[chnc]=pos; chnc++; } break; } int c; if (chnc%2!=0){ int w=0,t=0; for(int i=1;i<=winc;i++){ int c=0; for(int j=1;j<chnc;j++){ if(win[i].who[j]!=current.where[j] && win[i].where[j]!=current.where[j]){ c=1; } } if (c==0 && taken[win[i].where[chnc]]!=1 && taken[win[i].where[j]]!=2){ ps(win[i].where[chnc]); pos=win[i].where[chnc]; taken[win[i].where[chnc]]=2; o(win[i].where[chnc]); current.who[chnc]=2; current.where[chnc]=pos; chnc++; i=winc+3; w=1; } } if(w!=1){ for(int i=1;i<=tiec;i++){ int c=1; for (int j=1;j<chnc;j++){ if(tie[i].who[j]!=current.who[j] && tie[i].where[j]!=current.where[j]){ c=0; } } if (c==1 && taken[tie[i].where[chnc]]!=1 && taken[tie[i].where[chnc]]!=2){ pos=tie[i].where[chnc]; taken[pos]=2; o(pos); ps(pos); current.who[chnc]=2; current.where[chnc]=pos; chnc++; i=tiec+4; t=1; } } } if(t!=1 && w!=1){ randomize(); int rnd=rand()%9; if(rnd==0){ rnd=9; } pos=rnd; ps(pos); if(taken[pos]!=1 && taken[pos]!=2){ taken[pos]=2; o(pos); current.who[chnc]=2; current.where[chnc]=pos; chnc++; } } } makeboard(); ps(pos); gotoxy(1,20); chck(taken[1],taken[2],taken[3],taken[4],taken[5],taken[6],taken[7],taken[8],taken[9],0); }}void playtwo(){ setfillstyle(1,BLACK); bar(0,0,700,700); makeboard(); int ch=1,temp=0; char ans; game=1; int y,pos=1; win[1].who[1]=1; win[1].who[2]=2; win[1].who[3]=1; win[1].who[4]=2; win[1].who[5]=1; win[1].who[6]=2; win[1].who[7]=1; win[1].who[8]=2; win[1].who[9]=1; win[1].where[1]=1; win[1].where[2]=2; win[1].where[3]=3; win[1].where[4]=4; win[1].where[5]=5; win[1].where[6]=6; win[1].where[7]=7; win[1].where[8]=8; win[1].where[9]=9; winc++; int chnc=1; int taken[19]={0,0,0,0,0,0,0,0,0,0,0,0,0}; while (y!=27 && game==1){ ans=getch(); y=ans; switch(y){ case 72: if(pos!=1 && pos!=2 && pos!=3){ pos=pos-3; } break; case 80: if(pos!=7 && pos!=8 && pos!=9){ pos=pos+3; } break; case 77: if (pos!=9){ pos++; } break; case 75: if (pos!=1){ pos--; } break; case 32: if ( taken[pos]!=1 && taken[pos]!=2 && chnc%2==0){ x(pos); taken[pos]=1; current.who[chnc]=1; current.where[chnc]=pos; chnc++; } else if (taken[pos]!=1 && taken[pos]!=2 && chnc%2!=0){ o(pos); taken[pos]=2; current.who[chnc]=2; current.where[chnc]=pos; chnc++; } break; } makeboard(); ps(pos); chck(taken[1],taken[2],taken[3],taken[4],taken[5],taken[6],taken[7],taken[8],taken[9],1); }}void reset(){ game=1; for (int i=0;i<=10;i++){ current.who[i]=0; current.where[i]=0; }}void main(){ main: int gdriver=DETECT,gmode; initgraph(&gdriver, &gmode, "c:\\tc"); setcolor(BLUE); gotoxy(1,1); cout<<"1.One player."; cout<<"\n2.Two player."; int choice; cout<<"\nEnter the choice from the above menu : "; cin>>choice; if (choice==1){ playone(); }else if(choice==2){ playtwo(); } getch(); closegraph(); cout<<"Do you wan't to play again?"; char ans; cin>>ans; if (ans=='y'){ reset(); goto main; } getch();}
-
Here is the HangMan code -
/*HEADER FILES*/#include <iostream.h>#include <fstream.h>#include <process.h>#include <conio.h>#include <stdlib.h>#include <ctype.h>#include <graphics.h>#include <string.h>#include <dos.h>void BACKGROUND(int color) //The function that makes the background of the interface each time{ setfillstyle(11,color);//This sets the color as well as the texture of the background bar(0,0,1300,1300); //This makes a bar from the top most corner to the end of the screen}void DRAW_BOX(int x1,int y1,int x2,int y2,int color){ setcolor(color);//This sets the color of the boundary as given by the user rectangle(x1,y1,x2,y2);//This makes a rectangle rectangle(x1+1,y1+1,x2-1,y2-1);//This makes a rectangle smaller than the other one so as to make a border setfillstyle(1,0);//It sets the fill style as black bar(x1+2,y1+2,x2-2,y2-2);//It makes a black box in whic one can write.}/*CLASS HANGMAN AND ITS FUNCTIONS*/class HANGMAN{ private: char file[10000]; int score; int nofg; int ltbg; int i, now, flag, c, k,u; char word[50], g; int wrg; char gsf[50]; char guess[50]; public: void ARENA(); void LOST(); void WON(); void READ_FILE(); void PLAY(); void SHOW_BODY(int);}game;void HANGMAN::WON(){ delay(1000); BACKGROUND(4); DRAW_BOX(120,100,500,200,4); gotoxy(35,10); cout<<"YOU WON!"; delay(5000);}void HANGMAN::LOST(){ delay(1000); BACKGROUND(4); DRAW_BOX(120,100,500,200,4); gotoxy(35,10); cout<<"YOU LOST!"; gotoxy(20,11); cout<<"and the word to be guessed was "<<word; delay(5000);}void HANGMAN::SHOW_BODY(int part){ switch (part) { case 1: gotoxy(73,8); cout<<"0"; break; case 2: gotoxy(72,9); cout<<"\\"; break; case 3: gotoxy(73,9); cout<<"|"; break; case 4: gotoxy(74,9); cout<<"/"; break; case 6: gotoxy(72,11); cout<<"/"; break; case 7: gotoxy(74,11); cout<<"\\"; break; } if (part==5) { gotoxy(73,10); cout<<"|"; }}void HANGMAN::ARENA(){ i=now=flag=score=ltbg=c=k=u=wrg=0; gotoxy(1,1); BACKGROUND(4); DRAW_BOX(450,70,620,220,4); for(int j=0;j<50;j++) { word[j]='\'; guess[j]='\'; gsf[j]='\'; } while(file[i]!='\') { if(file[i]==' ' && file[i+1]!='\') { now++; } i++; } now++; randomize(); int r=random(now); i=now=0; while(file[i]!='\') { if(now==r) { word[c]=file[i]; c++; } if(file[i]==' ') { if (flag==1) { break; } now++; } i++; } u=c; word[c-1]='\'; c=c-2; DRAW_BOX(480,400,610,450,4); gotoxy(63,27); cout<<"Score: "; DRAW_BOX(20,250,620,330,4); //FOR ENTERING THE LETTER DRAW_BOX(70,85,150,120,4); //FOR CLUE HEADING gotoxy(11,7); cout<<"CLUE ->"; DRAW_BOX(195,85,380,120,4); //FOR CLUE, I.E BLANKS int counter=0; gotoxy(27,7); for(i=0;i<=c;i++) { char curr; curr=toupper(word[i]); if(curr=='A'|| curr=='E' || curr=='I' || curr=='O' || curr=='U') { cout<<curr<<""; gsf[counter]=curr; counter++; } else { cout<<"_"; ltbg++; gsf[counter]='_'; counter++; guess[k]=curr; k++; } } gotoxy(1,1); nofg=k; gotoxy(60,7); cout<<"--------------"; gotoxy(60,8); cout<<"| "; gotoxy(60,9); cout<<"| "; gotoxy(60,10); cout<<"| "; gotoxy(60,11); cout<<"| "; gotoxy(60,12); cout<<"|"; gotoxy(60,13); cout<<"=========="; PLAY();}void HANGMAN::PLAY(){ char g; int guessed=0; gotoxy(7,18); g='\'; int wr=0,r=0; while(wrg<7 && ltbg!=guessed) { wr=0; r=0; gotoxy(7,18); cout<<"Guess a letter:"; gotoxy(23,18); g=getch(); cout<<g; for(int i=0;i<=u;i++) { char did; did=toupper(g); char curr; if(did==word[i] && (did!='A'&& did!='E' && did!='I' && did!='O' && did!='U')) { gsf[i]=did; gotoxy(27,7); cout<<" "; gotoxy(27,7); cout<<gsf; gotoxy(1,1); guessed++; score+=10; r=1; } else { if(did!='A'&& did!='E' && did!='I' && did!='O' && did!='U') { wr=1; } } } if (wr==1 && r==0) { wrg++; score-=5; SHOW_BODY(wrg); } gotoxy(70,27); cout<<" "<<score<<" "; } if (ltbg==guessed) { WON(); } else { LOST(); }}void HANGMAN::READ_FILE(){ ifstream words("words.txt"); file[10000]; char j; int counter=0; while(words!='\') { words.get(j); cout<<j; file[counter]=j; counter++; } words.close(); ARENA();}/*THE CLASS INTERFACE AND ITS FUNCTIONS*/class INTERFACE{ private: int menuChoice; public: void INTRO(void);//This is the introduction page. void MAIN_MENU(void);//This function has the main menu void PLAY(); void HISCORE(); void HELP(); void QUIT();}menu;void INTERFACE::MAIN_MENU(){ BACKGROUND(1); DRAW_BOX(235,10,400,35,1); //To draw the box for putting main menu heading gotoxy(33,2); cout<<"<< MAIN MENU >>"; DRAW_BOX(170,90,470,240,1); gotoxy(34,8); cout<<"1: PLAY GAME"; gotoxy(34,10); cout<<"2: HELP"; gotoxy(34,12); cout<<"3: QUIT"; DRAW_BOX(170,260,470,330,1); gotoxy(27,18); cout<<"Enter your choice : "; menuChoice='\'; gotoxy(47,18); cin>>menuChoice; if(menuChoice>3 || menuChoice<1) { gotoxy(27,20); cout<<"Invalid Input\a"; delay(1000); MAIN_MENU(); } switch(menuChoice) { case 3: QUIT(); break; case 2: HELP(); break; case 1: game.READ_FILE(); break; } MAIN_MENU();}void INTERFACE::INTRO(void){ BACKGROUND(1);//This sets the background with a blue color DRAW_BOX(100,40,540,280,1);//This draws the box where the title is written gotoxy(24,10); cout<<"<<<<<<<<<<<< HANGMAN >>>>>>>>>>>>"; DRAW_BOX(450,370,610,450,1); gotoxy(59,25); cout<<"Developed by-"; gotoxy(59,26); cout<<"Pooja Saxena &"; gotoxy(59,27); cout<<"Krishanu Mathur"; delay(2000); //To delay the main menu screen for 2sec approx. MAIN_MENU();}void INTERFACE::QUIT(){ BACKGROUND(1);//This sets the background with a blue color DRAW_BOX(100,40,540,280,1);//This draws the box where the title is written gotoxy(30,9); cout<<"Thank You for playing"; gotoxy(37,11); cout<<"HANGMAN"; delay(2000); exit(0);}void INTERFACE::HELP(){ BACKGROUND(1); DRAW_BOX(235,10,400,35,1); //To draw the box for putting help heading gotoxy(36,2); cout<<"<< HELP >>"; DRAW_BOX(120,90,520,280,1); gotoxy(17,7); cout<<"Hangman is a game where you try to guess a "; gotoxy(17,8); cout<<"word one letter at time. Initially the player is"; gotoxy(17,9); cout<<"shown a pattern with only the vowels and a '_'"; gotoxy(17,10); cout<<"at the other places. Each time you guess a wrong"; gotoxy(17,11); cout<<"letter one part of the persons body appears.Like"; gotoxy(17,12); cout<<"so first the head then the hands then the upper"; gotoxy(17,13); cout<<"torso then the lower torso and finally the legs"; gotoxy(17,14); cout<<"appear on the screen after every wrong guess."; gotoxy(17,15); cout<<"The aim of the game is to guess the word shown"; gotoxy(17,16); cout<<"before the man fully apeears on the screen and"; gotoxy(17,17); cout<<"is hung at the gallows."; getch();}/*MAIN*/void main(void){ clrscr(); int gdriver=DETECT,gmode; //This is to initialize the graphics. initgraph(&gdriver, &gmode, "c:\\tc\\bgi");//This is the to open the graph in which we will draw. menu.INTRO(); getch();//This is to get a character before closing the graph. closegraph();//This is to close the graph.}// gotoxy(60,7);// cout<<"--------------";// gotoxy(60,8);// cout<<"| O";// gotoxy(60,9);// cout<<"| \\|/";// gotoxy(60,10);// cout<<"| |";// gotoxy(60,11);// cout<<"| / \\ ";// gotoxy(60,12);// cout<<"|";// gotoxy(60,13);// cout<<"==========";
-
Thanks, I don't know how I missed out that page! Sorry
-
Hello,I am working on some JS libraries and wanted to know how I can make my own objects and then have functions related to them and stuff??Could someone please point me towards a good tutorial for the same!?
-
This is really kool
-
Yeah..I think I saw it on some TV program when Bill Gates release IE to give competetion to Netscape which was the big browser then.
-
It is like it is better to have the index.html page but it can b something else too, if you change the htaccess(I think) It could be an animated GIF as well!!
-
FF 2.0.0.2 does not support animation in SVG yet...
-
-
This is called a Favicon. You can write the follwing code to add your own Favicon-
<link rel="icon" type="image/png" href="http://example.com/myicon.png">
More info on the following page - W3C Favicon
-
I dont think so, I am creating WebApps for another 2 years and then I wont do it again I think, cause there are no universites in India that give education in the field of WebDesing or Development and I cant afford to go abroad.I will most probably go in to Design and then do animation, digital graphics or similar sutff.Why do you call it the dark days??
-
Yup...I agreeIt is kind of hard to catch up with sarcasm and similar figures of speech when you can not actually hearing the person speak!
-
This is such a nice topic, I mean I have learnt so much just by reading the disscussion between NotJustBrowing and JustSomeGuy.It is soo cool that you people know so much about standards history of browsers and the standards that existed then. I really like this topic, a very nice learning place for me!
-
Arre I am not stubborn...I just meant that those who do want to do it like that.i too would do everything on the PHP page as everyone else!!
-
I said that if you are a stubborn person who wants to use JS no matter whatthat is why I made the word "do" bold
-
Hmm...I am not using OpenGL and I think that my code wont help you out cause at that time I used to write really messed up code. I am currently on my sister's laptop and when I come online through my desktop, I will try to find HangMan, ParaTrooper, and Pong in VJ++ or C++. I am not sure if I would have them or not cause while switching computers, I deleted a lot of crappy data. I have made a single player Tic Tac Toe in JS and Poing POng in JS too. But thet are not HTML files but .kon(Konfabulator)(Yahoo Widget Files) You can see the widgets of Tic Tac Toe and Pong.PongThis is an old but captivating game for all ages. One of the first arcade games is now on your desktop with the original controls.It is a good break from work - try it out.[[Details]]Tic Tac ToeHere is the popular Tic Tac Toe game, packed with some artificial intelligence. It can keep you glued for quite some time. A good break from work - try it out.[[Detais]]
-
If you do want to use JS for cheking the password you can first send an XMLHttpRequest to ask for the password from a PHP file that has encrypted it and is sending it. Use the same alogrithm to then decrypt it in JS. It would be better if it is Private Key Encryption so that even if someone knows the Algorithm you are using they wontbe able to crack the password!!
AwardSpace SQL Database
in General
Posted
Alright thank you!