Just 4 fun

Phisionary

Newbie
Joined
Jul 2, 2003
Messages
1,305
Reaction score
0
Hi! I'm just testing this out. Me my mo moo! May me my mo moo! Mo may me moo my! Moo may mee mo moo me my! No I'm not just spamming, in case this doesnt show up. It's a test!

Yay! It works! this took me way too long. All because of
Code:
(int)tempchar < 33 && (int)tempchar >= 127)
real smart... ugh. :x
 
sure. i didn't test it much, so it might be fragile. i compiled with VS.NET

More sample:
'input.txt' Sample input file. Note: A 10000 character post maximum limits you to 416 tagged characters. Less, with spaces and newlines.

zipped. includes .cpp source file, instructions, sample input file
 
thats pretty neat.. i have to mess with this..

maby load a bitmap to color ascii or something...
 
i thought of that. i've seen a similar program that would turn a bitmap into colored ascii html. was pretty cool. i was gonna implement somethign like that, but i don't have a hex editor right now, so it's tougher to make a bmp decoder. and the 10000 char post limitation makes it a small picture if you put it up here (though if you made it so it grouped sequencial same-color characters it would reduce the size some).

pls, stick it up here if you make anything cool.
 
Played with it for a bit during my lunch break at work.

EDIT: Added an asterisk (*) to stop the color code on the forum
TEST pppppp

Code:
#include <iostream>
#include <fstream>

using namespace std;

char dectohex(int x);
void setcolor(int r, int g, int b, char tempchar, char buffer[]);

int main()
{

	char buffer[30]  = {"[*color=xxxxxx]p[/color]"};

	ofstream outputFile("test.txt");	

	setcolor(8,150,255, 'y', buffer);
	outputFile << buffer;
	
	outputFile.close();
	
	return 0;
}

char dectohex(int x)
{
    char tempchar;
    
    // test for invalid entry
    if(x > 16 || x < 0)
    {
        tempchar = (char)42;
        return tempchar;
    }
    if(x <= 9)
    {
         // add from char 0
         tempchar = ((char)(48 + x));
         return tempchar;
    }
    if(x > 9)
    {
        // add from char 7
        tempchar = ((char)(55 + x));
        return tempchar;
    }
}

void setcolor(int r, int g, int b, char tempchar, char buffer[])
{
	// start from 0 ei. remeber fence-post counting...
	buffer[7]   = dectohex(r%16);
	buffer[8]   = dectohex(r/16);
	buffer[9]   = dectohex(g%16);
	buffer[10]  = dectohex(g/16);	
	buffer[11]  = dectohex(b%16);
	buffer[12]  = dectohex(b/16);
}

output: test.txt

Contains..

Code:
[*color=#8069FF]p[/color]
or
p
 
abcdefghijklmnopqrstuvwxyz

looks like it goes back to #000000 after so many chars...
looking into it
 
a few indexed loops

un-seeded rand()%
abcdefghijklmnopqrstuvwxyz

gradual color shift - i*.4 on the red channel
abcdefghijklmnopqrstuvwxyz

red and green color channels
abcdefghijklmnopqrstuvwxyz

red and blue
abcdefghijklmnopqrstuvwxyz

green and blue
abcdefghijklmnopqrstuvwxyz

uneven shift
abcdefghijklmnopqrstuvwxyz
 
I just figured out my problem

in the dectohex function i have the "/" and "%" mixed up

Red color shift
abcdefghijklmnopqrstuvwxyz

un-even shift
abcdefghijklmnopqrstuvwxyz

i*9.85
 
testing blehtesting blehtesting[color=G70094] [/color]
 
You people have far too much time on your hands. And compilers.

Tell me, is there any practical use for this that us real-worlders have for this? :)

It does seem a good project to learn CPP with though. Oh wait your using .NET?

Maybe I could do it in perl :)
 
I just wanted to see if i could do it :cheers:
 
Back
Top