Jump to content




Visual - Visualise any string, any length in to an image!


  • You cannot reply to this topic
7 replies to this topic

#1 billysback

  • Members
  • 569 posts

Posted 05 January 2013 - 04:19 AM

This is a little program which takes a string and creates an image, usually repetitive or pattern-like, based off of the string, use the same string and you get the same picture every time, any changes to the string could bring up an entirely different image however :P

Here's the pastebin:
http://pastebin.com/dYq0nJbr

Here's an example image (this is "hello")
Spoiler

Usage is: (visual is whatever you called the program)
visual <data>
example:
visual hello

If you want any other examples of strings I will be happy to post them here, or give examples of cool strings.
This was just a little test project of mine to see if I could visualize data, I might be taking this further to make some sort of game, I'll see what I can do. Either way, feel free to use the code for this in whatever you want, just thought I would share this :)

#2 wilcomega

  • Members
  • 466 posts
  • LocationHolland

Posted 05 January 2013 - 04:41 AM

very cool, have you got a image reader for it so it can be converted back into a string?

#3 kornichen

  • Members
  • 220 posts
  • LocationGermany

Posted 05 January 2013 - 04:53 AM

View Postwilcomega, on 05 January 2013 - 04:41 AM, said:

very cool, have you got a image reader for it so it can be converted back into a string?

That would be interesting :D

#4 billysback

  • Members
  • 569 posts

Posted 05 January 2013 - 04:55 AM

you mean take any image and turn it into a string?
hmmmm.... not really sure that would work as characters share colours...

#5 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 05 January 2013 - 05:22 AM

I've seen code like this very often in your programs:
while index > 16 do index = index - 16 end

Do you know about the modulo operator?
index = (index-1)%16+1
It's equivalent in length in this particular case (whilst modulo is more efficient). But in the case of your encryption program you posted once, it would've made stuff a hell of a lot simpler.

There's more stuff like that, but I shouldn't criticize a published program. I just wanted to make sure that you know modular math.

I'm not sure about the purpose of this program, but it looks funny. :P

#6 billysback

  • Members
  • 569 posts

Posted 05 January 2013 - 05:24 AM

View PostOrwell, on 05 January 2013 - 05:22 AM, said:

Do you know about the modulo operator?
index = (index-1)%16+1
There's more stuff like that, but I shouldn't criticize a published program. I just wanted to make sure that you know modular math.
no... I'm presuming it's the "%", in what way does it work?
n-1%17 returns a value less than 17 excluding 17 in a way that is similar or the same way to reducing it by that amount each time?


and its not exactly meant to have a "purpose" other than to look nice :P

#7 nutcase84

  • Members
  • 711 posts
  • LocationIn My Lonely Little Computer Corner

Posted 05 January 2013 - 05:27 AM

This is sweet. Great job.
EDIT: when i try to run this, it crashes the computer.

#8 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 05 January 2013 - 05:33 AM

View Postbillysback, on 05 January 2013 - 05:24 AM, said:

View PostOrwell, on 05 January 2013 - 05:22 AM, said:

Do you know about the modulo operator?
index = (index-1)%16+1
There's more stuff like that, but I shouldn't criticize a published program. I just wanted to make sure that you know modular math.
no... I'm presuming it's the "%", in what way does it work?
n-1%17 returns a value less than 17 excluding 17 in a way that is similar or the same way to reducing it by that amount each time?


and its not exactly meant to have a "purpose" other than to look nice :P
Actually, it just gives you the remainder of the division between the first and the second number. Thus:
11%4 == 3
17%5 == 2
(18-1)%17+1 == 2






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users