The "I don't know what to program so you will tell me what to program" Thread.
112 replies, posted
I'd be damn surprised if the vector result were any smaller than the raster in [I]any[/I] case.
[QUOTE=Elecbullet;38195650]I'd be damn surprised if the vector result were any smaller than the raster in [I]any[/I] case.[/QUOTE]
Yeah, 6kb png, 7mb svg. Hardmode would reduce it quite a lot though.
[QUOTE=Elecbullet;38188980]I could actually have a legitimate use for this. To my knowledge it has not been created, so:
Make a raster image vectorizer (suggestion: input PNG, output SVG) that makes an [I]exact[/I] copy of the image. Like, for a 64x64 sprite, it creates 4096 (=64x64) squares in the same positions as the pixels, which are the same colors as the pixels. [B]Hardmode:[/B] search for adjacent identical colors and merge them into one path to save storage space.
Very limited use but I actually have a situation here where I could find it very useful.[/QUOTE]
hardmode on this is actually a pretty fun challenge in itself; recreate a picture using the least amount of rectangles of a single color as possible. I did it as a side project a while ago, but I've lost the code since then.
[img]http://puu.sh/AzwI[/img]
there's one of the results. it was really slow, taking almost 4 minutes, but those were the best possible results.
It is SVG, it does not have to be all rectangles. A terrible, convoluted path would be equally useful.
I figure I'll put in a entry in the collatz club.
Python 2.7
[CODE]
from sys import argv
sc, numb = argv
number = int(numb)
def conject(num):
while num != 1:
if (num % 2) != 0:
num *= 3
num += 1
else:
num /= 2
print num
conject(number)
[/CODE]
Thoughts? Just started doing python recently.
I have about 5 projects that I need to finish one day or another.
But no, Collatz conjecture with recursion is so much more important.
C# by the way.
[code]
using System;
namespace Euler
{
class Program
{
static void Main(string[] args)
{
CollatzRecursion(1000);
#if DEBUG
Console.ReadLine();
#endif
}
static void CollatzRecursion(int number)
{
Console.WriteLine(number.ToString());
if (number != 1)
if (number % 2 == 0) // Number is even
CollatzRecursion(number / 2);
else // Number is uneven
CollatzRecursion((number * 3) + 1);
}
}
}
[/code]
My contribution to the Collatz craze:
[cpp]
from datetime import datetime
def string_to_graph(s):
s_len = len(s)
graph = list(s)
for i in range(s_len):
if i + 1 == s_len:
graph[i] = u"\u2588"
else:
graph[i] = u"\u2592"
return "".join(graph)
while True:
n = input('Enter a natural number (or "quit" to quit): ')
if n == "quit":
break
if not n.isdigit():
print("That's not a number!\n")
continue
n = int(n)
steps = 0
start_time = datetime.now()
while n != 1:
if n % 2 == 0:
n //= 2
else:
n = 3 * n + 1
print(string_to_graph(str(n)))
steps += 1
print("Done after ", steps, " steps (", datetime.now() - start_time, ")\n",
sep="")
[/cpp]
First thing I've ever written in Python.
The Collatz craze paid off, I'm in my Programming Lab and they want us to code an implementation of the Collatz conjecture. This is ridiculous.
Just an idea for anyone interested, i'd like to see someone create a randomly generated story/sentance creator.
Basically the idea is a bunch of random variables that would make up a sentence.
for example:
[X] {N} [V] {P} [X] {N} [C] {Pn} C
[The] {dog} [jumped] {onto} [the] {roof} [of] {The Empire State Building} [and] {died}
where X = (The, There, If, Once etc)
where N = noun
where V = verb
where P = something else
etc you get the point
I honestly don't know enough about grammatical structures or even programming to try and attempt this, but if someone did pull it off I think it'd be pretty cool.
Good luck gentlemen!
[QUOTE=Mettrone;38394037]Just an idea for anyone interested, i'd like to see someone create a randomly generated story/sentance creator.
Basically the idea is a bunch of random variables that would make up a sentence.
for example:
[X] {N} [V] {P} [X] {N} [C] {Pn} C
[The] {dog} [jumped] {onto} [the] {roof} [of] {The Empire State Building} [and] {died}
where X = (The, There, If, Once etc)
where N = noun
where V = verb
where P = something else
etc you get the point
I honestly don't know enough about grammatical structures or even programming to try and attempt this, but if someone did pull it off I think it'd be pretty cool.
Good luck gentlemen![/QUOTE]
If it was only one type of sentence strucuture, this would be pretty easy with enums and a randomizer. And even then, you could randomize the sentence strucutres to draw from.
[editline]10th November 2012[/editline]
I might actually try this, seeing as I'm bored and it would be a way to test out my radical java skillz
[QUOTE=Wealth + Taste;38396487]If it was only one type of sentence strucuture, this would be pretty easy with enums and a randomizer. And even then, you could randomize the sentence strucutres to draw from.
[editline]10th November 2012[/editline]
I might actually try this, seeing as I'm bored and it would be a way to test out my radical java skillz[/QUOTE]
Or, you can do a natural language processing thingy.
[QUOTE=amcfaggot;36629021]
[b]Project 2[/b]
Utilizing GeoIP and any network library or native OS network functions, create an application which displays the estimated location of the addresses your system makes connections to in real-time.
[/QUOTE]
Done
[url]http://status.liberumgamers.net/world/[/url]
[QUOTE=Mettrone;38394037]Just an idea for anyone interested, i'd like to see someone create a randomly generated story/sentance creator.
Basically the idea is a bunch of random variables that would make up a sentence.
for example:
[X] {N} [V] {P} [X] {N} [C] {Pn} C
[The] {dog} [jumped] {onto} [the] {roof} [of] {The Empire State Building} [and] {died}
where X = (The, There, If, Once etc)
where N = noun
where V = verb
where P = something else
etc you get the point
I honestly don't know enough about grammatical structures or even programming to try and attempt this, but if someone did pull it off I think it'd be pretty cool.
Good luck gentlemen![/QUOTE]
Studying formal and natural language processing here. There is a much better way to do this using syntax trees. Essentially, you have a sentence S which is split into a noun phrase (NP) and a verb phrase (VP). These can be further broken down into more components based on a Grammar (a set of rules which defines how each phrase should be further broken down). A grammar needs to eventually end in terminals (words, or "tokens") otherwise the generator/parser will recursively attempt to break the sentence down. Here's a good example of a parse tree:
[IMG]http://upload.wikimedia.org/wikipedia/commons/5/54/Parse_tree_1.jpg[/IMG]
(Taken from Wikipedia).
We've done parsing in the course, but never generation (the subject has been touched on but we have never been challenged). I think I'll give this a shot.
[B][I]Edit:
[/I][/B]This also allows the sentence to take on much more complex forms, due to recursion (a noun phrase can be broken down into another noun/verb phrase combo). E.g.
The man who likes the color blue hit the ball.
| NP || VP |
| NP | VP || V | Det | N |
| D | N | I | V | D | N | N || V | Det | N |
Yeah I'm bad at drawing a tree on a basic text editor but you get the idea.
Write a program that can generate, given hypothetically enough time and storage space; every possible pixel set in a 128x128 grayscale image.
make it so you can generate a unique index for each individual pixel set, and that you can enter that index to receive an image accordingly, allowing images to be shared between friends
As shown;
[IMG]http://i.imgur.com/fGUub.jpg[/IMG]
extra: if you are really tryhard fucking maximum etc, make the program pause and create a notification whenever it recognizes something that isn't just pure static
A program to simulate infinite monkey theorem:
[url]http://en.wikipedia.org/wiki/Infinite_monkey_theorem[/url]
[QUOTE=errington07;38581617]A program to simulate infinite monkey theorem:
[url]http://en.wikipedia.org/wiki/Infinite_monkey_theorem[/url][/QUOTE]
I don't think you can.
[QUOTE=dorkson0;38505452]Write a program that can generate, given hypothetically enough time and storage space; every possible pixel set in a 128x128 grayscale image.
make it so you can generate a unique index for each individual pixel set, and that you can enter that index to receive an image accordingly, allowing images to be shared between friends
As shown;
[t]http://i.imgur.com/fGUub.jpg[/t]
extra: if you are really tryhard fucking maximum etc, make the program pause and create a notification whenever it recognizes something that isn't just pure static[/QUOTE]
If you have to replicate every single image, I don't see any way to make this very interesting. I.e. the index and the image data would be identical. That's the simplest bijection I can think of.
[editline]25th November 2012[/editline]
The extra part would be interesting, however.
[QUOTE=Staneh;38582988]I don't think you can.[/QUOTE]
You can't make a program that produces letters at random?
[QUOTE=horsedrowner;38585742]You can't make a program that produces letters at random?[/QUOTE]
Ofcourse I can, it's just that you don't have enough time for it to generate a sentence that's actually a sentence.
[QUOTE=horsedrowner;38585742]You can't make a program that produces letters at random?[/QUOTE]
It would have to have spaces and punctuation, too. It's possible, given enough time.
You are remembering me my philosophy teacher...
Once she brought with her a 'text', we were told to pay attention while she read it, because it was supposed to be a complicated text. When she finished some people told what they thought the text was about (most of them talked about politics, administration, economics... ). Then she shown us what she has been reading, it was a 4-colomns table, where she had selected one random row, read the text and passed to the next column. That generated a nonsense text, which is grammatically correct. As i'm Spanish the tables are in spanish, so you may try to create something similar for english, i don't feel able to translate it all keeping it's functionallity.
I hope you find this of use [t]http://24.media.tumblr.com/tumblr_lifz9wgKPd1qzcdp3o1_1280.png[/t]
[B]edit:[/B]
i gave it a try, correct it as much as you can.
When you are using it, begin from the first cell, and your last phrase should begin with the last cell of the first colomn
[url]http://unnamedprojects.herobo.com/Dear%20peers.htm[/url]
[QUOTE=Staneh;38590006]Ofcourse I can, it's just that you don't have enough time for it to generate a sentence that's actually a sentence.[/QUOTE]
Well that's like my image generator thing. You only have to know it will produce a result eventually, you don't actually have to wait for the result. The fun is in creating it.
Sorry, you need to Log In to post a reply to this thread.