Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 08-02-08   #71 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,485

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 867
Trader Rating: 0
Default

Quote:
Originally Posted by rabidgnome229 View Post
Rofl - yeah that's the problem with the easy way. It has to check every shuffled word against every word in the dictionary.

I used a trie for this, which is actually kinda nifty. A trie is a tree where the head node represents an empty string. Hanging off of that are 26 nodes (one for each letter). The first node corresponds to a string containing 'a' as the first letter. Hanging off of that are 26 nodes, where the first node represents a string containing 'aa', the second represents 'ab', and so on. The end result is that when you're matching a shuffled word, it doesn't depend on the number of words you're checking against, only the length of the shuffled word. It takes just as long to find the word using a dictionary of 10 words as it does with a dictionary of 10 million words.
Nice.

I ran yours for fun against the 172K word list. Quite impressive
Code:
real    0m1.947s
user    0m0.344s
sys     0m0.028s
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 08-02-08   #72 (permalink)
With great difficulty
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,206

Rep: 613 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 369
FAQs Submitted: 6
Trader Rating: 5
Default

Quote:
Originally Posted by dangerousHobo View Post
Nice.

I ran yours for fun against the 172K word list. Quite impressive
Code:
real    0m1.947s
user    0m0.344s
sys     0m0.028s
My prof would have a bone to pick with me if the results had been anything else. The first few labs in my freshman C and UNIX course revolved around loading a dictionary (first with a resizing array, then a linked list, then whatever you want - meaning go learn how to make a trie if you want an A)
__________________
System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 08-02-08   #73 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,485

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 867
Trader Rating: 0
Default

Code:
#!/usr/bin/env ruby

unless ARGV.size == 2
    puts "Usage: ruby wordsort.rb scram_file wordlist_file"
    exit 0
end

scram = Hash.new

File.open(ARGV[0]).each do |word|
    word.chop!
    scram[word.split(//).sort.join] = word
end

File.open(ARGV[1]).each do |word|
    word.chop!
    #print "#{word} " if scram.has_key? word.split(//).sort.join
end
Code:
$ time ruby wordsort-hash.rb shuffle.txt 172K-words.txt                       

real    0m0.356s
user    0m0.304s
sys     0m0.004s
No way I can do better then that.

Note the commented out "print" line if it printed out everything to the terminal it'll obviously take longer:
real 0m3.832s

rabidgnome:
The execution time on yours if nothing it outputted.
Code:
$ time ./a.out                                                                 

real    0m0.353s
user    0m0.324s
sys     0m0.024s
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD

Last edited by dangerousHobo : 08-02-08 at 09:24 PM
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 08-03-08   #74 (permalink)
With great difficulty
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,206

Rep: 613 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 369
FAQs Submitted: 6
Trader Rating: 5
Default

Good call with the hashtable, I'm throwing together a quick one in C to compare performance (only cheating a little bit ). They should be similar (both are constrained by the length of the input, the trie from moving through the tree letter by letter, the table because it has to hash the string). I think the hashtable will have better constant factors though, because it doesn't have to move through a tree - it just has to jump into a table
__________________
System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 08-04-08   #75 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,485

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 867
Trader Rating: 0
Default

For fun I wrote it in perl too.
Not as elegant as ruby

Code:
#!/usr/bin/env perl

use warnings;
use strict;

if ($#ARGV+1 < 2) {
    print "Usage: perl wordsort.pl scram_file wordlist_filen";
    exit(0);
}

my %scram = ();

open(FILE, $ARGV[0]) || die "could not open file $ARGV[0]";
foreach (<FILE>) {
    chomp($_);
    my $sorted = join( "", sort { lc($a) cmp lc($b) } split(//,$_) ); # alphabetical sort
    $scram{$sorted} = $_;
}
close(FILE);

open(FILE2, $ARGV[1]) || die "could not open file $ARGV[1]";
foreach (<FILE2>) {
    chomp($_);
    print "matched: $_  " if $scram{join( "", sort { lc($a) cmp lc($b) } split(//,$_) )};
}
close(FILE2);
print "n";
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 08-07-08   #76 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,485

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 867
Trader Rating: 0
Default

The Challenge:
Ok this week I'm hoping to see some more submissions so we'll try one thats hopefully a little easier.

Write a program that can print out a shape given the desired number of lines and the character to be used.
The shapes that your program can handle is up to you, but of course the more the better.

Creativity and elegance are weighed to decide the winner. There is no prize, just bragging rights.

Any language is welcome.


Deadline:
Wednesday August 13th at 11:00pm EST.

Post any questions you have.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 08-08-08   #77 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,485

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 867
Trader Rating: 0
Default

Only three shapes.

Code:
#!/usr/bin/env ruby

if ARGV.size < 2
    puts "Useage: ruby shape.rb [shape] [char] {size}"
    exit 0
end

SHAPE = ARGV.shift
CHAR = ARGV.shift
if SHAPE !~ /triangle|diamond|square/
    puts "unknown shape....exiting"
    exit 0
end

if ARGV[0]
    Size = ARGV.shift.to_i
else
    Size = 5
end


def pad(pos, shape)
    case shape
    when 'triangle' : " "*CHAR.size*(Size+1 - pos)
    when 'diamond' : " "*CHAR.size*(Size/2+1 - pos)
    end
end


case SHAPE
when 'square'
    (1..Size).each { puts CHAR*Size }
when 'triangle'
    (1..Size).each { |n| puts pad(n, 'triangle') + ("#{CHAR}"+" "*CHAR.size)*n }
when 'diamond'
    (1..Size/2+1).each { |n| puts pad(n, 'diamond') + ("#{CHAR}"+" "*CHAR.size)*n }
    (Size/2).downto(1) { |n| puts pad(n, 'diamond') + ("#{CHAR}"+" "*CHAR.size)*n }
end
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 08-08-08   #78 (permalink)
Programmer
 
amd nvidia

Join Date: Mar 2008
Location: UIUC
Posts: 235

Rep: 34 OasisGames is acknowledged by some
Unique Rep: 30
Trader Rating: 0
Default

Something I'm working on: PHP + SVG. Should be able to do virtually any shape when done. Draws an SVG, calls rsvg to rasterize it, then processes it through the gd libraries and generates some ascii art. Works in a terminal as well. (granted, for the currently hard-coded drawing, you need a really big terminal window) (it'll work perfectly in a standard 80-wide terminal now)

Shouldn't take much time to add some options. (done)

Question: Do you want some compensation for the none-square aspect of a typical console font? (I'll add an option later)


Shapes so far:
- Rectangles
- Circles
- Lines
- Star
- Triangle
- Diamond
- OCN Logo - haha, had to draw it myself

Specify a shape with do=[square | circle | line | star | triangle | diamond | ocn], size with &size=[##], character with &char=[character]
Default is a square, size of 80, char=#

PHP Code:
<?php
$chars 
= array('#'' ');
function 
rasterize($svg) {
    
$svgfile fopen("/tmp/rasterize.svg"'w');
    
fwrite($svgfile$svg);
    
fclose($svgfile);
    
$rsvg exec("rsvg /tmp/rasterize.svg /tmp/rasterize.png");
}
function 
draw($url)     {
    global 
$chars;
    
$quality 1;
    
$img imagecreatefrompng($url);
    
$width imagesx($img);
    
$height imagesy($img);
    
$output '';
    for(
$y 0$y $height$y $y $quality) {
        for(
$x 0$x $width$x $x $quality) {
            
$pixel_color imagecolorat($img$x$y);
            
$rgb imagecolorsforindex($img$pixel_color);
            
$brightness $rgb['red'] + $rgb['green'] + $rgb['blue'];
            
$brightness round($brightness / (765 / (count($chars) - 1)));
            
$char $chars[$brightness];
            
$output .= $char;
        }
        
$output .= "n";
    }
    
    return 
$output;
}
function 
drawSquare($size 80) {
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="stroke:black;fill:black;stroke-width:0" >
       <rect x="10" y="10" width="$size" height="$size" />
     </g>
   </svg>
END
);
}
function 
drawStar($size 80) {
    
$sizeb $size 240;
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$size" />
     </g>
     <g style="stroke:black;fill:black;stroke-width:0" >
         <path
       d="M 0,-80 L 30,10 L 120,10 L 40,60 L 70,150 L 0,90 L -70,150 L -40,60 L -120,10 L -30,10 L 0,-80 z"
       transform="scale($sizeb) translate(120, 80)" />
     </g>
   </svg>
END
);
}
function 
drawTriangle($size 80) {
    
$sizeb $size 2;
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$size" />
     </g>
     <g style="stroke:black;fill:black;stroke-width:0" >
         <path
       d="M $sizeb,0 L $size,$size L 0,$size L $sizeb,0 z" />
     </g>
   </svg>
END
);
}
function 
drawDiamond($size 80) {
    
$sizeb $size 2;
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$size" />
     </g>
     <g style="stroke:black;fill:black;stroke-width:0" >
         <path
       d="M $sizeb,0 L $size,$sizeb L $sizeb,$size L 0,$sizeb L $sizeb,0 z" />
     </g>
   </svg>
END
);
}
function 
drawCircle($size 80) {
    
$sizeb $size 2;
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$size" />
     </g>
     <g style="stroke:black;fill:black;stroke-width:0" >
         <circle cx="$sizeb" cy="$sizeb" r="$sizeb" />
     </g>
   </svg>
END
);
}
function 
drawLine($size 80) {
rasterize(<<<END
   <svg width="$size" height="$size" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$size" />
     </g>
     <g style="stroke:black;fill:black;stroke-width:0" >
         <line x1="0" y1="$size" x2="$size" y2="0"
            style="stroke-width: 4" />
     </g>
   </svg>
END
);
}
function 
drawOCN($size 80) {
$sizeb $size 80;
$sizec 96 $size 80;
rasterize(<<<END
   <svg width="$size" height="$sizec" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">
     <g style="fill:white">
        <rect x="0" y="0" width="$size" height="$sizec" />
     </g>
  <g
     transform=" scale($sizeb) translate(-96.64074,-24.50504)"
     id="layer1">
    <path
       d="M 101.00841,64.905786 C 96.712639,72.218833 85.823676,105.94921 130.15832,118.70526 C 174.57281,127.06068 176.85863,79.617965 176.49133,75.747505 C 176.02174,76.68422 174.65028,77.179431 172.60467,78.611356 C 170.55907,80.043281 168.30889,80.452402 168.30889,80.452402 C 168.30889,80.452402 172.91151,75.133823 173.21835,66.13315 C 173.41144,60.405051 169.53626,53.450385 169.53626,53.450385 C 169.53626,53.450385 168.67563,61.529547 164.52453,65.826309 C 158.69454,71.86085 150.81895,74.31558 150.81895,74.31558 C 150.81895,74.31558 156.03526,66.746833 153.58053,58.053001 C 151.83512,51.871349 142.63653,41.892702 138.13619,36.778685 C 134.19626,32.30149 133.49839,30.038614 131.48796,24.50504 C 131.21631,30.835988 132.63378,42.669473 130.46516,46.49532 C 128.20956,50.474615 126.02706,54.794102 121.66905,52.734422 C 116.43392,50.2602 119.21432,41.17674 119.21432,41.17674 C 119.21432,41.17674 108.45284,45.496234 107.55435,58.973524 C 106.32699,77.486271 111.85013,90.475879 111.85013,90.475879 C 110.57595,88.50665 106.32699,84.645896 103.66771,77.793112 C 101.18551,71.396674 101.48141,68.373764 101.00841,64.905786 z"
       id="path2409"
       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path
       d="M 163.39944,50.688814 C 167.00779,49.41993 166.87697,47.594831 166.5957,44.833263 C 166.30342,41.937024 159.8452,32.610759 159.8452,32.610759 C 159.8452,32.610759 159.43608,35.70474 159.23152,39.079993 C 159.02695,42.455244 159.47012,43.733302 159.76849,46.54646 C 160.12647,49.896142 162.03103,51.170018 163.39944,50.688814 z"
       id="path3181"
       style="fill:#000000;fill-opacity:0.96078431;fill-rule:evenodd;stroke:#000000;stroke-width:0.14319251px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path
       d="M 143.55084,111.94341 C 147.8453,111.79566 152.27765,110.17876 155.11473,105.40881 C 159.74426,97.62525 156.35964,87.437423 156.35964,87.437423 C 156.35964,87.437423 156.2411,88.26779 154.53313,91.128734 C 153.20517,93.353156 147.54599,97.430942 147.54599,97.430942 C 147.54599,97.430942 150.10299,92.108287 149.34466,86.58302 C 148.75081,82.284457 147.5034,77.712836 140.70454,70.850456 C 142.29517,73.570894 144.77514,88.859826 135.68146,91.805521 C 129.21434,93.900399 123.89382,82.308057 118.70292,76.668029 C 118.72832,82.892522 119.3166,89.759915 121.77133,94.05569 C 125.42534,100.45021 130.772,104.28373 130.772,104.28373 C 130.772,104.28373 128.21499,105.30653 125.24886,104.69285 C 122.34425,104.0919 118.49836,102.8518 118.49836,102.8518 C 118.49836,102.8518 123.86838,107.53628 128.62412,109.6023 C 141.10232,115.02316 143.14793,105.20425 143.14793,105.20425 C 143.14793,105.20425 144.37529,105.92021 144.47758,108.17038 C 144.57985,110.42055 143.81275,111.72955 143.55084,111.94341 z"
       id="path3183"
       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
    <path
       d="M 131.7181,83.469672 C 131.7181,83.469672 129.22131,78.954188 129.85148,75.133823 C 131.4169,65.669214 135.23723,63.00979 136.90882,60.124178 C 137.85147,58.49693 137.75296,56.553847 137.62479,54.473187 C 137.03634,56.739443 135.58859,59.690662 133.76371,62.297636 C 132.68976,63.831843 125.12101,72.397822 125.45342,76.668028 C 125.71008,79.945317 128.64968,81.961038 131.7181,83.469672 z"
       id="path3185"
       style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
  </g>
</svg>
END
);
}
$arg $_GET['do'];
$no_pre false;
if (
$argc 1) {
    
$arg $argv[1];
    
$no_pre true;
}
if (
$argc 2) {
    
$size $argv[2];
} else {
    
$size 80;
    if ((int)
$_GET['size'] > 0) {
        
$size = (int)$_GET['size'];
    }
}
if (
$argc 3) {
    if (
$argv[3] == "-aa") {
        
$chars = array("#","%","&","*","0","Z","z","\"","'","."," ");
    }
}
if (
$_GET['aa'] == "yes") {
    
$chars = array("#","%","&","*","0","Z","z","\"","'","."," ");
}
if (isset(
$_GET['char'])) {
    
$chars = array($_GET['char'], " ");
}
if (
$argc 4) {
    
$chars = array($argv[4], " ");
}
if (
$arg == "square") {
    
drawSquare($size);
} elseif (
$arg == "star") {
    
drawStar($size);
} else if (
$arg == "circle") {
    
drawCircle($size);
} else if (
$arg == "line") {
    
drawLine($size);
} else if (
$arg == "triangle") {
    
drawTriangle($size);
} else if (
$arg == "diamond") {
    
drawDiamond($size);
} else if (
$arg == "ocn") {
    
drawOCN($size);
} else {
    
drawSquare($size);
}
$asc draw('/tmp/rasterize.png');
if (!
$no_pre) {
print 
"<pre>" $asc "</pre>";
} else {
print 
$asc;
}
unlink("/tmp/rasterize.png");
unlink("/tmp/rasterize.svg");
?>
__________________
Retired Compiz Developer
Ubuntu Alpha Tester

System: Harmony
CPU
Phenom II X4 (4x 3.0GHz)
Motherboard
BIOSTAR TA790GXB
Memory
4GB DDR2
Graphics Card
ECS GeForce 9800 GT
Hard Drive
1TB Seagate 7200RPM
Sound Card
Built-in ATI 3870 HD + old SoundBlaster Audigy SE
Power Supply
mushkin 550200 550W
Case
COOLER MASTER Elite 330
OS
Ubuntu Linux 9.04 (x86 ...)
Monitor
2x ViewSonic VA2226W (22" LCDs)

Last edited by OasisGames : 08-11-08 at 07:13 PM Reason: Added OCN logo. Like I said, should be able to do anyt shape.
OasisGames is offline   Reply With Quote
Old 08-08-08   #79 (permalink)
With great difficulty
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,206

Rep: 613 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 369
FAQs Submitted: 6
Trader Rating: 5
Default

More string manipulation huh? If my haskell book gets here I might take a whack at this
__________________
System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Old 08-11-08   #80 (permalink)
Overclocker in Training
 
intel nvidia

Join Date: Nov 2005
Posts: 195

Rep: 3 loco1172 Unknown
Unique Rep: 3
Folding Team Rank: 770
Trader Rating: 2
Default

im taking my :turd: ms compiler and going home
__________________
CPU-Z Validation
GPU-Z Validation

System: slow POS (getting faster)
CPU
E6600 @ 3.5 v1.496
Motherboard
EVGA 680i A1 SLI
Memory
2 x 2gb G.Skill 1000
Graphics Card
2 x EVGA 8800 GTX SLI
Hard Drive
500gb wd, 250gb wd, 250gb maxtor
Power Supply
Antec TruePower Trio 650 Watt
Case
CM 690
CPU cooling
TRUE & yate loom D12SH-12 (lapped)
GPU cooling
Stock (better needed)
OS
Vista 64 Bit (SP1)
Monitor
Envision 20" LCD
loco1172 is offline I fold for Overclock.net   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 10:00 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.19467 seconds with 9 queries