Ante
Jump to navigation
Jump to search
Ante is an esoteric programming language where all you've got is a deck of playing cards. The language was created by Michael Dvorkin in 2013. Original Ante interpreter was developed in Ruby, versions in Go, Rust, and Swift are also available.
Operators, Sequential Precedence
♦ # Add ♥ # Multiply ♠ # Subtract ♣ # Divide
Syntax
2-9[x]... # Assignment; the suit of first card designates # target register A[x] # Current value of register [x] (the Ace aces it) K[x] # Jump to the last Q[x] label if A[x] != 0 (go see the Queen) Q[x] # Label (the Queen is waiting) J[x] # Print A[x] as character (Jack shows the goods) 10[x] # Print A[x] as number Kings and Queens can have twins, triplets, etc. of the same suit. While single K♥ goes to Q♥, K♥K♥ twins will go to Q♥Q♥ and so on.
Examples
# # puts "Hello, world!" # 9♦ 8♥ J♦ A♦ 2♣ 3♥ 7♠ J♦ A♦ 7♦ J♦ J♦ A♦ 3♦ J♦ 5♥ 6♦ 4♥ J♥ A♥ 6♠ 6♠ J♥ A♦ 8♦ J♦ A♦ 8♠ J♦ A♦ 3♦ J♦ A♦ 6♠ J♦ A♦ 8♠ J♦ A♥ 3♦ 2♠ J♥ A♥ 2♣ 6♠ J♥ # Run one more time (the same code compacted). 9♦8♥J♦A♦2♣3♥7♠J♦A♦7♦J♦J♦A♦3♦J♦5♥6♦4♥J♥A♥6♠6♠J♥A♦8♦J♦A♦8♠J♦A♦3♦J♦A♦6♠J♦A♦8♠J♦A♥3♦2♠J♥A♥2♣6♠J♥
# 15.times { |i| print i } 3♥ 5♥ # ♥ = 3 * 5 Q♥ # Label 10♦ # Print current value of ♦ A♦ 3♦ 2♠ # ♦ = ♦ + 3 - 2 A♥ 3♠ 2♦ # ♥ = ♥ - 3 + 2 K♥ # Jump to Q♥ if ♥ != 0
For more examples check out *.ante files at Ante Github page including Yusuke Endoh's mind-boggling Ante quine (the program that prints itself): Ante Quine