PDA

View Full Version : Latest Game



Malcolm
December 13th, 2002, 08:10
Let my program read your mind...
(I'll port to linux once I get Gentoo running :))

CpU MasteR
December 13th, 2002, 08:31
/me burps

It works 3/4ths of the time ;)

Freaky o_O

mesman00
December 13th, 2002, 23:31
im scared...i've seen this before, mind sharing your source code?

Malcolm
December 14th, 2002, 01:02
Originally posted by mesman00
im scared...i've seen this before, mind sharing your source code?

do you guys really want to see the code?

Malcolm
December 14th, 2002, 01:07
Ok here it is.

Yes I know its sloppy but I made it in about 5 mins after Flow`` directed me to the site thats listed at the end of the program.



/*
for the includes below change the ( to < and ) to >, this is because the forum doesn't display text inside < >
#include (iostream.h)
#include (stdlib.h) //take out for linux
#include (stdio.h) //take out for linux
*/



int main(){
char array[99];
int y=0;
bool finish=false;

cout << "This program will read your mind!\nThink of a number with 2 digits (ex: 54)\nSubtract from this number its 2 digits (ex: 54 - 5 - 4 = 45)\nFind the symbol that corresponds to this number\nConsentrate on this number and symbol, \nhit Y then enter for your symbol to be revealed!\n\n";
while(finish == false){
for(int x=99;x>=0;x--){
y++;
array[x]=35 + (rand()%10);
}

array[81]=array[0];
array[72]=array[0];
array[63]=array[0];
array[45]=array[0];
array[36]=array[0];
array[27]=array[0];
array[18]=array[0];
array[9]=array[0];

for(int j=99;j>=0;j--){
y++;
cout << j << ": " << array[j] << "\t";

if(y<=10){
cout << endl;
y=0;
}

}

cout << "Are you ready? (Y)";
cin >>array[1];
cout << "\nYour symbol is: " << array[0] << "\nMAU HAHAHAHA\n\n**Extracting credit Number**\n\n";
cout << "Go again? (Y/other)";
cin >> array[1];
if (array[1]=='y' || array[1]=='Y'){
finish=false;
system("cls"); //comment out for linux
}
else{
finish=true;
cout << "Y not pressed, ending.\n\nThis game was coded by Malcolm of Emulation64.com/EmuTalk.net\n\nIdea copied from:\nhttp://www.twc.sshunet.nl/~olaudy/MindReader.html\n";
system("pause"); //comment out for linux
}
}
return 0;
}


:)

Im a good cheater eh? :P

mesman00
December 14th, 2002, 01:31
nifty

aprentice
December 14th, 2002, 04:01
was wrong for me :happy:

Malcolm
December 14th, 2002, 04:27
Originally posted by aprentice
was wrong for me :happy:

technically it can't be wrong, its actually quite impossible... unless you can't subtract properly...

icepir8
December 14th, 2002, 07:04
Originally posted by Malcolm
technically it can't be wrong, its actually quite impossible... unless you can't subtract properly...

No Malcolm, It is wrong if you pick any number from 10 to 19.

there must be a bug in your program.

:)

Malcolm
December 14th, 2002, 13:39
Originally posted by icepir8
No Malcolm, It is wrong if you pick any number from 10 to 19.

there must be a bug in your program.

:)

Humm... well teaches me for not testing it

smcd
July 28th, 2004, 04:02
Malcom just a few nitpicks but you never seeded the PRNG and you don't need the stdio.h and you use deprecated C++ header form. :P

A good way to seed it would be

// quotes will work but < > are proper
#include "iostream"
#include "cstdlib"
#include "ctime"

/* lazy way */
using namespace std;

srand((unsigned)time(NULL)); // seed that baby the best we can!


/**//**//**//**//**//**//**/
//revives old[ancient] thread

mesman00
July 28th, 2004, 22:34
hi, welcome to two years ago. hahaha.

sammyboy
July 28th, 2004, 23:35
mine comes up with a blank screen,

thats a really clever program.