Revision cd5c6180-edca-4c20-8081-85c770acd873 - Code Golf Stack Exchange

## 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](http://golf.shinh.org/lranking.rb). 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](http://golf.shinh.org/p.rb?eight+hundred), [really](http://golf.shinh.org/p.rb?Print+line+number+prefix) [good](http://golf.shinh.org/p.rb?parity+of+numbers).

> **Note**: I'll encode all of the programs in [CP437](https://en.wikipedia.org/wiki/Code_page_437), 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](http://stackoverflow.com/a/64124/257418)'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!

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