Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^6: Very Large Hex Combinations

by danambroseUK (Beadle)
on Aug 04, 2005 at 17:11 UTC ( #480938=note: print w/replies, xml ) Need Help??

in reply to Re^5: Very Large Hex Combinations
in thread Very Large Hex Combinations

Yes I am aware that there is going to be *minor* storage issues - what I am after is proof of concept a script that could produce, well start producing every combination possible.

How might this be coded?

Just imagine this could a project like seti whereby using idle computer time do the calculations, they have logged years of computing time in this way.


Replies are listed 'Best First'.
Re^7: Very Large Hex Combinations
by 5mi11er (Deacon) on Aug 04, 2005 at 18:45 UTC
    You're not crazy, you're in denial. You can't have more data than there are atoms in the universe. What would you store it on?

    Proof of concept? For a script to "start" the process? Why? We've already (pretty much) proven that such a script would never even make it to generating a single interesting picture in the sun's life time; unless you think all black is interesting.

    You'd be better off trying to create interesting randomly generated images than heading down this road.


      A few false assumptions there. First you assume that you can only store one peice of data per atom, when in fact you might not need atoms at all to store data. Second I would guess that since atoms can be desetroyed, that then they can be created, and therefor the number of currently estimated atoms should be of no concern. ;)

      I'm sure most of us can remember thinking the idea of storing the entire library of congress on our home computers was ludicrous. And when 56k was blazing fast. Technologic barriers are meant to be broken, and we often wrongly assume they are uncermountable when it is actualy just so different from our current thinking that we can't see the answer.

      Of course, all that said, i still agree that randomly generating focused pictures would be more interesting.....Or you could activily filter the randomly created images, dropping those that include your uncle or other relatives you don't want to see now or 10 years from now! ;)

      Kinda a funny theory though, if ever instance in life can be captured in a picture, and you can randomly generate every possible picture, then you can generate pictures of things that are going to happen...or things that happened 100's of years ago. I wonder if that is the basis of tea leaf reading? ;)

      Eric Hodges
Re^7: Very Large Hex Combinations
by Anonymous Monk on Aug 05, 2005 at 11:15 UTC
    The program below will get you started. It generates all 8x8 images using just black and white pixels, storing them in PBM format, requiring only 15 bytes per file.

    Without counting overhead of inodes and directories, you only need to solve the *minor* *minor* *minor* storage issue of 257,698,037,760 Tb.

    On my computer, it took more than an hour to generate all 3x8 bitmaps. Rounding that down to an hour, an estimate to do all 8x8 bitmaps is 125 million years.

    That's 125 million years for an image consisting of a mere 64 bits. A 480x640 bitmap contains 307200 bits, the full colour version 7372800 bits. Realizing that a single bit more means doubling of your computer time you must come to the conclusion your quest is unfeasable.

    Really, it's cheaper to just subscribe to the porn sites instead of generating your smut images this way.

    Here's the code:

    #!/usr/bin/perl use strict; use warnings; my $dir = "/tmp"; foreach my $r1 (0x00 .. 0xFF) { my $d1 = sprintf "$dir/%02X", $r1; mkdir $d1 or die "mkdir $d1: $!\n"; foreach my $r2 (0x00 .. 0xFF) { my $d2 = sprintf "$d1/%02X", $r2; mkdir $d2 or die "mkdir $d2: $!\n"; foreach my $r3 (0x00 .. 0xFF) { my $d3 = sprintf "$d2/%02X", $r3; mkdir $d3 or die "mkdir $d3: $!\n"; foreach my $r4 (0x00 .. 0xFF) { my $d4 = sprintf "$d3/%02X", $r4; mkdir $d4 or die "mkdir $d4: $!\n"; foreach my $r5 (0x00 .. 0xFF) { my $d5 = sprintf "$d4/%02X", $r5; mkdir $d5 or die "mkdir $d5: $!\n"; foreach my $r6 (0x00 .. 0xFF) { my $d6 = sprintf "$d5/%02X", $r6; mkdir $d6 or die "mkdir $d6: $!\n"; foreach my $r7 (0x00 .. 0xFF) { my $d7 = sprintf "$d6/%02X", $r7; mkdir $d7 or die "mkdir $d7: $!\n"; foreach my $r8 (0x00 .. 0xFF) { my $f8 = sprintf "$d7/%02X", $r8; open my $fh, ">", $f8 or die "open $f8: $!\n"; printf $fh "%s\n%d %d\n", "P4", 8, 8; print $fh pack "C8", $r1, $r2, $r3, $r4, $r5, $r6, $r +7, $r8; close $fh or die "close $f8: $!\n"; } } } } } } } } __END__

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://480938]
[Discipulus]: get them all printed on screen
Discipulus ;=)
[shmem]: silly question, silly answer:
[Discipulus]: i know, i know..
[shmem]: man perlfunc |perl -nle '$ok++ if /Alphabetical Listing of Perl Functions/;if($ok ){$s{$1}++if /^ (\w+)/}}{for(keys %s){$f="prototype \\\&CORE::$_"; eval"$f"||delete $CORE::{$_}}print for sort keys%CORE::'
[shmem]: well, there are some builtins which don't have a prototype...
[Discipulus]: eh eh.. i was looking in toke.c but dunno if is already used

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-05-23 10:02 GMT
Find Nodes?
    Voting Booth?