Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

Length 3

0▓B 30 B2 42

If the first byte of a program is 30, it's in line mode -- sort of like Perl/Ruby's flags. The remainder of the program, B2 42, will get mapped over each line of input.

B2 is called counter, and the first time you push it, it's 1, the second time it's 2, etc. There's no way to reset it or anything. Dead simple.

42 is swap, which will put the counter before the lines we're looping over. Thus this will perform a very lazy kind of line numbering:

abc 1abc
defgh -> 2defgh
gs2! 3gs2!

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

Length 3

0▓B 30 B2 42

If the first byte of a program is 30, it's in line mode -- sort of like Perl/Ruby's flags. The remainder of the program, B2 42, will get mapped over each line of input.

B2 is called counter, and the first time you push it, it's 1, the second time it's 2, etc. There's no way to reset it or anything. Dead simple.

42 is swap, which will put the counter before the lines we're looping over. Thus this will perform a very lazy kind of line numbering:

abc 1abc
defgh -> 2defgh
gs2! 3gs2!

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

Length 3

0▓B 30 B2 42

If the first byte of a program is 30, it's in line mode -- sort of like Perl/Ruby's flags. The remainder of the program, B2 42, will get mapped over each line of input.

B2 is called counter, and the first time you push it, it's 1, the second time it's 2, etc. There's no way to reset it or anything. Dead simple.

42 is swap, which will put the counter before the lines we're looping over. Thus this will perform a very lazy kind of line numbering:

abc 1abc
defgh -> 2defgh
gs2! 3gs2!
Post Made Community Wiki by Dennis
length 3
Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

Length 3

0▓B 30 B2 42

If the first byte of a program is 30, it's in line mode -- sort of like Perl/Ruby's flags. The remainder of the program, B2 42, will get mapped over each line of input.

B2 is called counter, and the first time you push it, it's 1, the second time it's 2, etc. There's no way to reset it or anything. Dead simple.

42 is swap, which will put the counter before the lines we're looping over. Thus this will perform a very lazy kind of line numbering:

abc 1abc
defgh -> 2defgh
gs2! 3gs2!

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437, as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

Length 3

0▓B 30 B2 42

If the first byte of a program is 30, it's in line mode -- sort of like Perl/Ruby's flags. The remainder of the program, B2 42, will get mapped over each line of input.

B2 is called counter, and the first time you push it, it's 1, the second time it's 2, etc. There's no way to reset it or anything. Dead simple.

42 is swap, which will put the counter before the lines we're looping over. Thus this will perform a very lazy kind of line numbering:

abc 1abc
defgh -> 2defgh
gs2! 3gs2!
length 1
Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437 , as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Length 1

f

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

gs2

Factoid

gs2 is my own little golf language that has the highest average score across submissions of all languages on shinh's golf site. It uses all 256 bytes, so it's like a cross between CJam and machine code. It's not perfect, but sometimes it's really, really good.

Note: I'll encode all of the programs in CP437 , as if they were printed on a DOS computer, because I don't know of any better character set that assigns a symbol to all 255 bytes. (Even this one lacks a glyph for FF. Oh well.) To the right of each snippet, you'll find a hex dump.

Length 1

f 66

I wanted to one-up goruby's 1-byte Hello, world!, so... This prints "1\n2\nFizz\n4\nBuzz\n...". :)

Length 2

ï≡ 8B F0

8B is Python's islower() function, but it also works on bytes. __ F0 is a 1-byte-block filter (it goes all the way up to __ __ __ __ __ __ F5). Thus, this program extracts all of the lowercase characters from STDIN.

length 1
Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285
Loading
Source Link
lynn
  • 69.7k
  • 11
  • 137
  • 285
Loading

AltStyle によって変換されたページ (->オリジナル) /