Support Forums

Full Version: Post your CTRL+V.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Calea Zacetechichi
hmmmmmmmmmmmm :L
#include <iostream>
#include <windows.h>
#include <list>

char Map[20][60] = {"###########################################################",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"# #",
"###########################################################"};


/* -=- Fruit Spawn -=- */
bool Fruit = true;
/* -=- Interval -=- */
unsigned short MovementInterval = 1; // 1 millisecond = 0.001 seconds
/* -=- Player Score -=- */
unsigned int PScore = 0;
/* -=- Functions -=- */
void gotoxy(unsigned short x, unsigned short y);
void DrawMap();
void DropFruit();
void AddScore(int points);

/* -=- Key Press -=- */
#define RIGHT 0
#define LEFT 1
#define DOWN 2
#define UP 3

class Snake
{

private:
bool Dead;
unsigned short Dir;
unsigned short Hx,Hy;
std::list<unsigned int> Lx,Ly;


public:
void SetDirection(unsigned short direction){Dir = direction;}
void HandleKeys();
void SnakeMove();
bool CheckDead(){return Dead;};
void Grow();
void SetSnake();
};
void Snake::Grow()
{
Lx.push_front(Lx.front());
Ly.push_front(Ly.front());
return;
}
void Snake::SnakeMove()
{
if(Dir == RIGHT){

if(Map[Hy][Hx+1] == '#' || Map[Hy][Hx+1] == 'o') //Collision
{
Dead = true;
}else
{
if(Map[Hy][Hx+1] == '*') // Fruit
{
Fruit = true;
AddScore(100);
}
Hx++;
}

}else if(Dir == LEFT){

if(Map[Hy][Hx-1] == '#' || Map[Hy][Hx-1] == 'o')
{
Dead = true;
}else
{
if(Map[Hy][Hx-1] == '*')
{
Fruit = true;
AddScore(100);
}
Hx--;
}

}else if(Dir == DOWN){

if(Map[Hy+1][Hx] == '#' || Map[Hy+1][Hx] == 'o')
{
Dead = true;
}else
{
if(Map[Hy+1][Hx] == '*')
{
Fruit = true;
AddScore(100);
}
Hy++;
}

}
else if(Dir == UP){

if(Map[Hy-1][Hx] == '#' || Map[Hy-1][Hx] == 'o')
{
Dead = true;
}else
{
if(Map[Hy-1][Hx] == '*')
{
Fruit = true;
AddScore(100);
}
Hy--;
}
}

if(Dead != true)
{
if(Fruit == true)
{
Grow();
}

Ly.push_back(Hy);
Lx.push_back(Hx);

Map[Ly.back()][Lx.back()] = 'o';
Map[Ly.front()][Lx.front()] = ' ';

Ly.pop_front();
Lx.pop_front();

gotoxy(0,0);
DrawMap();
}

return;
}
void Snake::HandleKeys()
{

if(GetAsyncKeyState(VK_RIGHT) != 0)
{
if(Dir != LEFT)
SetDirection(RIGHT);
}
else if(GetAsyncKeyState(VK_UP) != 0)
{
if(Dir != DOWN)
SetDirection(UP);
}
else if(GetAsyncKeyState(VK_DOWN) != 0)
{
if(Dir != UP)
SetDirection(DOWN);
}
else if(GetAsyncKeyState(VK_LEFT) != 0)
{
if(Dir != RIGHT)
SetDirection(LEFT);
}
return;
}
void Snake::SetSnake()
{
Hx = 10;
Hy = 15;
Lx.push_back(8);
Lx.push_back(9);
Lx.push_back(10);

Ly.push_back(15);
Ly.push_back(15);
Ly.push_back(15);


Map[Ly.back()][Lx.back()] = 'o';
Map[Ly.back()][Lx.back()-1] = 'o';
Map[Ly.back()][Lx.back()-2] = 'o';
return;
}

int main()
{
SetConsoleTitleA("BlueMelon's Snake");
Snake PSnake;

PSnake.SetSnake ();
PSnake.SetDirection(RIGHT);

while(PSnake.CheckDead() != true)
{
Sleep(MovementInterval);
if(Fruit == true)
{
DropFruit();
}

PSnake.HandleKeys();
PSnake.SnakeMove();

if(PSnake.CheckDead() == true)
{
using namespace std;
system("cls"); // This is only a one time thing, do not use this on a loop, bad practice.
cout << "Game Over!\n";
cout << "Press \'Return\' Key to Continue...";
cin.get();
return 0;
}

}


return 0;
}

void DropFruit()
{
srand(GetTickCount());
unsigned short Fruitx = rand() % 57 +1;
unsigned short Fruity = rand() % 18 +1;

if(Map[Fruity][Fruitx] == 'o') // Check if its going to drop on snake
{
DropFruit();
}else
{
Map[Fruity][Fruitx] = '*';
}

Fruit = false;
return;
}

void gotoxy(unsigned short x, unsigned short y)
{
static HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
static COORD WritePos;
WritePos.X = x;
WritePos.Y = y;
SetConsoleCursorPosition(hStdOut,WritePos);
}

void DrawMap()
{
using std::cout;
for(unsigned short rows=0; rows < 20 ; rows++)
cout << Map[rows] << "\n";

//Menu Points etc.
cout << "# #\n";
cout << "# #\n";
cout << "# #\n";
cout << "###########################################################";
gotoxy(46,22);
cout << "Score: " << PScore;
return;
}

void AddScore(int points)
{
PScore += points;
return;
}
thats not my source btw
[Image: 12803092585502_ctrlV.jpg]

I could not be bothered removing the keys and taking single shots or cutting the pic. Im lazy.
But thats my Ctrl & V

*edited image as it was too big. Sorry bout that.
Control+V:
Release

I was telling some guy were vb.net compiles to XD...
Nahomish
[Image: aywmu1.png]

That's my signature from HF. I'm making lots of them for other members on there too. Big Grin
Need 10 post here to use a signature though, so I guess I'll have to wait. :/
you never filed a tax return to the IRS. they will not know who you are or where you are etc. I knew a guy that started a business he was from another country. He never filed a tax return and never paid. His son wanted a car and so the dealership asked for tax returns. He didn't have any so he thought why not it's just paper. So he filed a tax return and before he knew it the IRS gave a letter saying he is going to be audited. The guy had relatives in the U.S and had his son live with them while he fled to another country. He closed the shop and told the IR

.. Lol I was copy and pasting a guide from HF into google to make sure he didn't steal it.

Red Pill

@echo off
title Code
echo Press any key to generate code.
pause >nul
cls
echo Please wait...
:a
set a= %random%
:b
set b= %random%
if "%b%"=="%a%" goto b
:c
set c= %random%
if "%c%"=="%a%" goto c
if "%c%"=="%b%" goto c
:d
set d= %random%
if "%d%"=="%a%" goto d
if "%d%"=="%b%" goto d
if "%d%"=="%c%" goto d
:e
set e= %random%
if "%e%"=="%a%" goto e
if "%e%"=="%b%" goto e
if "%e%"=="%c%" goto e
if "%e%"=="%d%" goto e
:f
set f= %random%
if "%f%"=="%a%" goto f
if "%f%"=="%b%" goto f
if "%f%"=="%c%" goto f
if "%f%"=="%d%" goto f
if "%f%"=="%e%" goto f
:g
set g= %random%
if "%g%"=="%a%" goto g
if "%g%"=="%b%" goto g
if "%g%"=="%c%" goto g
if "%g%"=="%d%" goto g
if "%g%"=="%e%" goto g
if "%g%"=="%f%" goto g
:h
set h= %random%
if "%h%"=="%a%" goto h
if "%h%"=="%b%" goto h
if "%h%"=="%c%" goto h
if "%h%"=="%d%" goto h
if "%h%"=="%e%" goto h
if "%h%"=="%f%" goto h
if "%h%"=="%g%" goto h
:i
set i= %random%
if "%i%"=="%a%" goto i
if "%i%"=="%b%" goto i
if "%i%"=="%c%" goto i
if "%i%"=="%d%" goto i
if "%i%"=="%e%" goto i
if "%i%"=="%f%" goto i
if "%i%"=="%g%" goto i
if "%i%"=="%h%" goto i
:j
set j= %random%
if "%j%"=="%a%" goto j
if "%j%"=="%b%" goto j
if "%j%"=="%c%" goto j
if "%j%"=="%d%" goto j
if "%j%"=="%e%" goto j
if "%j%"=="%f%" goto j
if "%j%"=="%g%" goto j
if "%j%"=="%h%" goto j
if "%j%"=="%i%" goto j
:k
set k= %random%
if "%k%"=="%a%" goto k
if "%k%"=="%b%" goto k
if "%k%"=="%c%" goto k
if "%k%"=="%d%" goto k
if "%k%"=="%e%" goto k
if "%k%"=="%f%" goto k
if "%k%"=="%g%" goto k
if "%k%"=="%h%" goto k
if "%k%"=="%i%" goto k
if "%k%"=="%j%" goto k
:l
set l= %random%
if "%l%"=="%a%" goto l
if "%l%"=="%b%" goto l
if "%l%"=="%c%" goto l
if "%l%"=="%d%" goto l
if "%l%"=="%e%" goto l
if "%l%"=="%f%" goto l
if "%l%"=="%g%" goto l
if "%l%"=="%h%" goto l
if "%l%"=="%i%" goto l
if "%l%"=="%j%" goto l
if "%l%"=="%k%" goto l
:m
set m= %random%
if "%m%"=="%a%" goto m
if "%m%"=="%b%" goto m
if "%m%"=="%c%" goto m
if "%m%"=="%d%" goto m
if "%m%"=="%e%" goto m
if "%m%"=="%f%" goto m
if "%m%"=="%g%" goto m
if "%m%"=="%h%" goto m
if "%m%"=="%i%" goto m
if "%m%"=="%j%" goto m
if "%m%"=="%k%" goto m
if "%m%"=="%l%" goto m
:n
set n= %random%
if "%n%"=="%a%" goto n
if "%n%"=="%b%" goto n
if "%n%"=="%c%" goto n
if "%n%"=="%d%" goto n
if "%n%"=="%e%" goto n
if "%n%"=="%f%" goto n
if "%n%"=="%g%" goto n
if "%n%"=="%h%" goto n
if "%n%"=="%i%" goto n
if "%n%"=="%j%" goto n
if "%n%"=="%k%" goto n
if "%n%"=="%l%" goto n
if "%n%"=="%m%" goto n
:o
set o= %random%
if "%o%"=="%a%" goto o
if "%o%"=="%b%" goto o
if "%o%"=="%c%" goto o
if "%o%"=="%d%" goto o
if "%o%"=="%e%" goto o
if "%o%"=="%f%" goto o
if "%o%"=="%g%" goto o
if "%o%"=="%h%" goto o
if "%o%"=="%i%" goto o
if "%o%"=="%j%" goto o
if "%o%"=="%k%" goto o
if "%o%"=="%l%" goto o
if "%o%"=="%m%" goto o
if "%o%"=="%n%" goto o
:p
set p= %random%
if "%p%"=="%a%" goto p
if "%p%"=="%b%" goto p
if "%p%"=="%c%" goto p
if "%p%"=="%d%" goto p
if "%p%"=="%e%" goto p
if "%p%"=="%f%" goto p
if "%p%"=="%g%" goto p
if "%p%"=="%h%" goto p
if "%p%"=="%i%" goto p
if "%p%"=="%j%" goto p
if "%p%"=="%k%" goto p
if "%p%"=="%l%" goto p
if "%p%"=="%m%" goto p
if "%p%"=="%n%" goto p
if "%p%"=="%o%" goto p
:q
if "%q%"=="%a%" goto q
if "%q%"=="%b%" goto q
if "%q%"=="%c%" goto q
if "%q%"=="%d%" goto q
if "%q%"=="%e%" goto q
if "%q%"=="%f%" goto q
if "%q%"=="%g%" goto q
if "%q%"=="%h%" goto q
if "%q%"=="%i%" goto q
if "%q%"=="%j%" goto q
if "%q%"=="%k%" goto q
if "%q%"=="%l%" goto q
if "%q%"=="%m%" goto q
if "%q%"=="%n%" goto q
if "%q%"=="%o%" goto q
if "%q%"=="%p%" goto q
:r
set r= %random%
if "%r%"=="%a%" goto r
if "%r%"=="%b%" goto r
if "%r%"=="%c%" goto r
if "%r%"=="%d%" goto r
if "%r%"=="%e%" goto r
if "%r%"=="%f%" goto r
if "%r%"=="%g%" goto r
if "%r%"=="%h%" goto r
if "%r%"=="%i%" goto r
if "%r%"=="%j%" goto r
if "%r%"=="%k%" goto r
if "%r%"=="%l%" goto r
if "%r%"=="%m%" goto r
if "%r%"=="%n%" goto r
if "%r%"=="%o%" goto r
if "%r%"=="%p%" goto r
if "%r%"=="%q%" goto r
Confused
set s= %random%
if "%s%"=="%a%" goto s
if "%s%"=="%b%" goto s
if "%s%"=="%c%" goto s
if "%s%"=="%d%" goto s
if "%s%"=="%e%" goto s
if "%s%"=="%f%" goto s
if "%s%"=="%g%" goto s
if "%s%"=="%h%" goto s
if "%s%"=="%i%" goto s
if "%s%"=="%j%" goto s
if "%s%"=="%k%" goto s
if "%s%"=="%l%" goto s
if "%s%"=="%m%" goto s
if "%s%"=="%n%" goto s
if "%s%"=="%o%" goto s
if "%s%"=="%p%" goto s
if "%s%"=="%q%" goto s
if "%s%"=="%p%" goto s
:t
set t= %random%
if "%t%"=="%a%" goto t
if "%t%"=="%b%" goto t
if "%t%"=="%c%" goto t
if "%t%"=="%d%" goto t
if "%t%"=="%e%" goto t
if "%t%"=="%f%" goto t
if "%t%"=="%g%" goto t
if "%t%"=="%h%" goto t
if "%t%"=="%i%" goto t
if "%t%"=="%j%" goto t
if "%t%"=="%k%" goto t
if "%t%"=="%l%" goto t
if "%t%"=="%m%" goto t
if "%t%"=="%n%" goto t
if "%t%"=="%o%" goto t
if "%t%"=="%p%" goto t
if "%t%"=="%q%" goto t
if "%t%"=="%p%" goto t
if "%t%"=="%s%" goto t
:u
set u= %random%
if "%u%"=="%a%" goto u
if "%u%"=="%b%" goto u
if "%u%"=="%c%" goto u
if "%u%"=="%d%" goto u
if "%u%"=="%e%" goto u
if "%u%"=="%f%" goto u
if "%u%"=="%g%" goto u
if "%u%"=="%h%" goto u
if "%u%"=="%i%" goto u
if "%u%"=="%j%" goto u
if "%u%"=="%k%" goto u
if "%u%"=="%l%" goto u
if "%u%"=="%m%" goto u
if "%u%"=="%n%" goto u
if "%u%"=="%o%" goto u
if "%u%"=="%p%" goto u
if "%u%"=="%q%" goto u
if "%u%"=="%p%" goto u
if "%u%"=="%s%" goto u
if "%u%"=="%t%" goto u
:v
set v= %random%
if "%v%"=="%a%" goto v
if "%v%"=="%b%" goto v
if "%v%"=="%c%" goto v
if "%v%"=="%d%" goto v
if "%v%"=="%e%" goto v
if "%v%"=="%f%" goto v
if "%v%"=="%g%" goto v
if "%v%"=="%h%" goto v
if "%v%"=="%i%" goto v
if "%v%"=="%j%" goto v
if "%v%"=="%k%" goto v
if "%v%"=="%l%" goto v
if "%v%"=="%m%" goto v
if "%v%"=="%n%" goto v
if "%v%"=="%o%" goto v
if "%v%"=="%p%" goto v
if "%v%"=="%q%" goto v
if "%v%"=="%p%" goto v
if "%v%"=="%s%" goto v
if "%v%"=="%t%" goto v
if "%v%"=="%u%" goto v
:w
set w= %random%
if "%w%"=="%a%" goto w
if "%w%"=="%b%" goto w
if "%w%"=="%c%" goto w
if "%w%"=="%d%" goto w
if "%w%"=="%e%" goto w
if "%w%"=="%f%" goto w
if "%w%"=="%g%" goto w
if "%w%"=="%h%" goto w
if "%w%"=="%i%" goto w
if "%w%"=="%j%" goto w
if "%w%"=="%k%" goto w
if "%w%"=="%l%" goto w
if "%w%"=="%m%" goto w
if "%w%"=="%n%" goto w
if "%w%"=="%o%" goto w
if "%w%"=="%p%" goto w
if "%w%"=="%q%" goto w
if "%w%"=="%p%" goto w
if "%w%"=="%s%" goto w
if "%w%"=="%t%" goto w
if "%w%"=="%u%" goto w
if "%w%"=="%v%" goto w
:x
set x= %random%
if "%x%"=="%a%" goto x
if "%x%"=="%b%" goto x
if "%x%"=="%c%" goto x
if "%x%"=="%d%" goto x
if "%x%"=="%e%" goto x
if "%x%"=="%f%" goto x
if "%x%"=="%g%" goto x
if "%x%"=="%h%" goto x
if "%x%"=="%i%" goto x
if "%x%"=="%j%" goto x
if "%x%"=="%k%" goto x
if "%x%"=="%l%" goto x
if "%x%"=="%m%" goto x
if "%x%"=="%n%" goto x
if "%x%"=="%o%" goto x
if "%x%"=="%p%" goto x
if "%x%"=="%q%" goto x
if "%x%"=="%p%" goto x
if "%x%"=="%s%" goto x
if "%x%"=="%t%" goto x
if "%x%"=="%u%" goto x
if "%x%"=="%v%" goto x
if "%x%"=="%w%" goto x
:y
set y= %random%
if "%y%"=="%a%" goto y
if "%y%"=="%b%" goto y
if "%y%"=="%c%" goto y
if "%y%"=="%d%" goto y
if "%y%"=="%e%" goto y
if "%y%"=="%f%" goto y
if "%y%"=="%g%" goto y
if "%y%"=="%h%" goto y
if "%y%"=="%i%" goto y
if "%y%"=="%j%" goto y
if "%y%"=="%k%" goto y
if "%y%"=="%l%" goto y
if "%y%"=="%m%" goto y
if "%y%"=="%n%" goto y
if "%y%"=="%o%" goto y
if "%y%"=="%p%" goto y
if "%y%"=="%q%" goto y
if "%y%"=="%p%" goto y
if "%y%"=="%s%" goto y
if "%y%"=="%t%" goto y
if "%y%"=="%u%" goto y
if "%y%"=="%v%" goto y
if "%y%"=="%w%" goto y
if "%y%"=="%x%" goto y
:z
set z= %random%
if "%z%"=="%a%" goto z
if "%z%"=="%b%" goto z
if "%z%"=="%c%" goto z
if "%z%"=="%d%" goto z
if "%z%"=="%e%" goto z
if "%z%"=="%f%" goto z
if "%z%"=="%g%" goto z
if "%z%"=="%h%" goto z
if "%z%"=="%i%" goto z
if "%z%"=="%j%" goto z
if "%z%"=="%k%" goto z
if "%z%"=="%l%" goto z
if "%z%"=="%m%" goto z
if "%z%"=="%n%" goto z
if "%z%"=="%o%" goto z
if "%z%"=="%p%" goto z
if "%z%"=="%q%" goto z
if "%z%"=="%p%" goto z
if "%z%"=="%s%" goto z
if "%z%"=="%t%" goto z
if "%z%"=="%u%" goto z
if "%z%"=="%v%" goto z
if "%z%"=="%w%" goto z
if "%z%"=="%x%" goto z
cls
echo a is %a% >>gencode.txt
echo b is %b% >>gencode.txt
echo c is %c% >>gencode.txt
echo d is %d% >>gencode.txt
echo e is %e% >>gencode.txt
echo f is %f% >>gencode.txt
echo g is %g% >>gencode.txt
echo h is %h% >>gencode.txt
echo i is %i% >>gencode.txt
echo j is %j% >>gencode.txt
echo k is %k% >>gencode.txt
echo l is %l% >>gencode.txt
echo m is %m% >>gencode.txt
echo n is %n% >>gencode.txt
echo o is %o% >>gencode.txt
echo p is %p% >>gencode.txt
echo q is %p% >>gencode.txt
echo r is %r% >>gencode.txt
echo s is %s% >>gencode.txt
echo t is %t% >>gencode.txt
echo u is %u% >>gencode.txt
echo v is %v% >>gencode.txt
echo w is %w% >>gencode.txt
echo x is %x% >>gencode.txt
echo y is %y% >>gencode.txt
echo z is %z% >>gencode.txt
echo Code Generated.
pause
:filename
cls
echo Where would you like the code to be stored?
echo Blank or non-existant text file only. Ex: code.txt
set /p fname= File Name:
if "%fname%"=="gencode.txt" goto gencodefname
echo Type the message to code one letter at a time in plain text.
echo Generator is also case sensitive, please only use lowercase.
pause
cls
:gencode
echo Type "done" when finished.
set /p le= Letter:
if "%le%"=="done" goto done
if "%le%"=="a" echo %a% >>%fname%
if "%le%"=="b" echo %b% >>%fname%
if "%le%"=="c" echo %c% >>%fname%
if "%le%"=="d" echo %d% >>%fname%
if "%le%"=="e" echo %e% >>%fname%
if "%le%"=="f" echo %f% >>%fname%
if "%le%"=="g" echo %g% >>%fname%
if "%le%"=="h" echo %h% >>%fname%
if "%le%"=="i" echo %i% >>%fname%
if "%le%"=="j" echo %j% >>%fname%
if "%le%"=="k" echo %k% >>%fname%
if "%le%"=="l" echo %l% >>%fname%
if "%le%"=="m" echo %m% >>%fname%
if "%le%"=="n" echo %n% >>%fname%
if "%le%"=="o" echo %o% >>%fname%
if "%le%"=="p" echo %p% >>%fname%
if "%le%"=="q" echo %q% >>%fname%
if "%le%"=="r" echo %r% >>%fname%
if "%le%"=="s" echo %s% >>%fname%
if "%le%"=="t" echo %t% >>%fname%
if "%le%"=="u" echo %u% >>%fname%
if "%le%"=="v" echo %v% >>%fname%
if "%le%"=="w" echo %w% >>%fname%
if "%le%"=="x" echo %x% >>%fname%
if "%le%"=="y" echo %y% >>%fname%
if "%le%"=="z" echo %z% >>%fname%
goto gencode
:done
echo Printing
print gencode.txt
print %fname%
pause
exit
:gencodefname
echo This filename is being used by the program.
echo Choose another.
pause
goto filename