Skip to main content

How I generated the code above.How I generated the code above:

#!/usr/bin/env perl

# Usage: perl $0 STRING
# Generates a code that stores given STRING
# to ;1 array in CLC-INTERCAL's binary IO model
# so it can be output by DOREADOUT;1, 
# without spaces.

my $line = shift;
my @values = unpack("C*", $line);
    my $ptr = 0;
    my @val = ();
    my $io = 172;
    for my $datum (@values) {
        my $chr = $datum;
        my $chr0 = $chr;
        my $bits0 = 0;
        my $bits1 = 0;
        for (my $i = 0; $i < 8; $i++) {
            if ($io & 0x80) {
                $bits0 <<= 1;
                $bits0 |= 1 if $chr & 0x80;
            } else {
                $bits1 <<= 1;
                $bits1 |= 1 if ! ($chr & 0x80);
            }
            $chr <<= 1;
            $io <<= 1;
        }
        $chr = int(rand 0xffff) + 1;
        for (my $i = 0; $i < 8; $i++) {
            $chr <<= 2;
            $chr |= 2 if $bits0 & 0x80;
            $chr |= 1 if $bits1 & 0x80;
            $bits0 <<= 1;
            $bits1 <<= 1;
        }
        $datum = $chr;
        $io = $chr0;
    }
print "DO;1<-#" . @values;
for my$i(0..$#values) {
   my $clcii = $i + 1;
   my $x = $values[$i] & 0xffff;
   print 'DO,1SUB#' . $clcii . '<-#' . $x if $x;
}

How I generated the code above:

#!/usr/bin/env perl

# Usage: perl $0 STRING
# Generates a code that stores given STRING
# to ;1 array in CLC-INTERCAL's binary IO model
# so it can be output by DOREADOUT;1, 
# without spaces.

my $line = shift;
my @values = unpack("C*", $line);
    my $ptr = 0;
    my @val = ();
    my $io = 172;
    for my $datum (@values) {
        my $chr = $datum;
        my $chr0 = $chr;
        my $bits0 = 0;
        my $bits1 = 0;
        for (my $i = 0; $i < 8; $i++) {
            if ($io & 0x80) {
                $bits0 <<= 1;
                $bits0 |= 1 if $chr & 0x80;
            } else {
                $bits1 <<= 1;
                $bits1 |= 1 if ! ($chr & 0x80);
            }
            $chr <<= 1;
            $io <<= 1;
        }
        $chr = int(rand 0xffff) + 1;
        for (my $i = 0; $i < 8; $i++) {
            $chr <<= 2;
            $chr |= 2 if $bits0 & 0x80;
            $chr |= 1 if $bits1 & 0x80;
            $bits0 <<= 1;
            $bits1 <<= 1;
        }
        $datum = $chr;
        $io = $chr0;
    }
print "DO;1<-#" . @values;
for my$i(0..$#values) {
   my $clcii = $i + 1;
   my $x = $values[$i] & 0xffff;
   print 'DO,1SUB#' . $clcii . '<-#' . $x if $x;
}

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

Therefore I had to use binary I/O instead to shorten the program.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

Therefore I had to use binary I/O instead to shorten the program.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

added 93 characters in body
Source Link
user100411
user100411

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

I think this is the only site that you can try CLC-INTERCAL online.

CLC-INTERCAL, 221 bytes.

DO;1<-#13DO;1SUB#1<-#29DO;1SUB#2<-#1100DO;1SUB#3<-#249DO;1SUB#4<-#255DO;1SUB#5<-#250DO;1SUB#6<-#677DO;1SUB#7<-#373DO;1SUB#8<-#4160DO;1SUB#9<-#570DO;1SUB#10<-#2572DO;1SUB#11<-#225DO;1SUB#12<-#247DO;1SUB#13<-#348DOREADOUT;1

How I generated the code above.

There is other "Hello, World!" program that uses a tail array, but it has 278 bytes when I do these:

  • Remove GIVE UP statement
  • Replace PLEASE with DO, as politeness doesn't matter in CLC-INTERCAL
  • Remove every space and LF.

I think this is the only site that you can try CLC-INTERCAL online.

Edit. As of 1.-94.-2, politeness is not checked, unlike INTERCAL-72 and CLC-INTERCAL.

Source Link
user100411
user100411
Loading