Join us on Discord!
You can help CodeWalrus stay online by donating here.

Tweetjam

Started by Yuki, July 18, 2016, 11:37:37 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Yuki

Post your best code here. Only requirement: the code must fit on a tweet. 140 characters or less.

No deadline, no winner, multiple participations allowed, must be a full program written by you. Use the [code] tag to put your code in and specify the language and what it does. You might even use the karma buttons to vote on the entries, if you want, and even improve on other entries. Have fun.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

That seems interesting. I think this was done before elsewhere but I forgot where. Maybe it was one of the Cwick contests or something. What are the platform restrictions?

Now I wonder if a full game can be coded under 140 characters of code...
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Yuki

Pretty sure we had a bunch of contests with that restriction. but this time, it's the only one. (That and the usual code golf and common sense rules.) No platform restriction. It was done on the Lexaloffle BBS for PICO-8 carts too, for the record.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

Aah thanks for explaining. I wasn't sure anymore.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

calcplays

The Oregon Trail for Python 2.7

l=[" "]
while l[-1]!="":
    l+=[raw_input("Name: ")]
raw_input("You depart!")
for j in l[1:-1]:
    raw_input(j+" has dysentery.")

Directions: You and your wagon party are about to venture across the frontier to build a new life in the Wild West.
Enter in the names of your party members and advance with an empty name.
Then, carefully traverse and survive in your journey across the United States. Press enter to advance.

Yuki

#5
Code (woooo.rb) Select
s=IO.new(3,"w")rescue File.open(File::NULL,"w")
print"w"
8.times{print"oo"
188.times{(0..255).each{|i|s.print i.chr}}}
puts


Fits on a tweet exactly. (That's a bonus in this thread.) It's in Ruby, save it as woooo.rb, run it like this:

Code (Linux) Select
ruby woooo.rb 3> >(aplay -q -r48000 -)
Code (macOS) Select
brew install sox
ruby woooo.rb 3> >(play -q -c 2 -b 8 -e unsigned -t raw -r 48k -)

Code (Windows) Select
¯\_(ツ)_/¯

Enjoy a 8-second sawtooth tone while the terminal seems happy. Bonus: remove the poor excuse of a reversed heart that is 3> and everything after (which should be the command you use to play raw sound from stdin) and it goes silent. Wrote this to demonstrate outputting text and sound to stdout at the same time, isn't that great? Could have used stderr as well (which would be 2> instead of 3>, but if you omit 2> and everything after it would output garbage in the terminal instead of doing nothing), but I wanted to demonstrate the use of file descriptor numbers greater than 2.

EDIT:
Code (bash) Select
curl -s https://mobile.twitter.com/juju2143/status/755613582776229888|xmllint --xpath '//div[@data-id="755613582776229888"]/div' --html -|sed 's/<[^>]*>//g'|ruby 3> >(aplay -q -r48000 -)

Run this on your Linux terminal, it downloads the above code from Twitter and runs it. That line also fits exactly in a tweet.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Dream of Omnimaga

#6
Here's a TI-BASIC game. Exactly 140 characters large (or 99 bytes on-calc with the program name)

AxesOff
ZTrig
For(Z,0,9³
randInt(⁻8,8→A
Line(A,2,A+1,2
For(θ,Z²,9³
End
Line(A,2,A+1,2,20
Input
If A≠int(X
Then
Disp "PTS:",Z
Return
End
End




Basically you have to memorize where the line appears then click at the matching X position. Yay for the Input command with no argument. :P I attached the file below for those who wants to try it.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

JWinslow23

#7
My entry is in TI-BASIC. With the program name "T" (for Tweetjam :P ), this is exactly 140 bytes on-calc, and it works on both color and mono calcs.

It's a Stacker-type game.

The pieces move rapidly back and forth. Press 2nd to stack your pieces.

Land your pieces not on the stack, and you lose one piece. Lose all your pieces and it's game over. Get to the top and you win.



ClrHome
DelVar A8→H
5→L
While H and Ans
A+1
Ans-2Ans(Ans+L=13→A
1+abs(Ans
Output(H,Ans," "+sub("*****",1,L)+" 
If getKey=21
Then
If H=8 or Ans<B+M and Ans>B-L
Then
Ans→B
H-1→H
L→M
Else
L-1→L
End
End
End
If Ans
Disp "W

I suppose I went a bit overboard with the game choice, but that's me trying to fit an actual game into 140 bytes! :D

Dream of Omnimaga

Nice, but doesn't tweetjam count 140 as individual characters rather than tokens? Because in this case your code is 218 characters (for example, Output( is 7 characters). ???
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U


Dream of Omnimaga

Maybe there is a way. :P good job nonetheless, though. I wonder if an RPG can be done under 1 KB of code...
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

c4ooo

Quote from: JWinslow23 on July 20, 2016, 01:28:47 PM
Oh, this is strictly CHARACTERS?

That changes everything. I'll get to remaking a game.
Just open the program in a hex editor and convert it to base 256, that way your program will still fit into a tweet ;)

Yuki

The goal is to fit the code on one tweet on Twitter, so of course it's 140 characters. Unless you manage to post it tokenized on Twitter, that is. That gives me an idea.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

c4ooo

Twitter counts characters as bytes so I estimate you would be able to get over 250 bytes in a tweet. (Not all combinations of bits are valid UTF characters)
And then of course you can tweet an image (containg your code in a PNG format), which will allow you even more bytes, but that's probly cheating :P

Yuki

Quote from: c4ooo on July 20, 2016, 08:07:26 PM
And then of course you can tweet an image (containg your code in a PNG format), which will allow you even more bytes, but that's probly cheating :P
That probably wouldn't work if Twitter do some sort of conversion after uploading the image. I'm not sure, but Facebook definitely does it.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Powered by EzPortal