Entropy

From Esolang
Jump to navigation Jump to search
Entropy
Paradigm(s) imperative
Designed by Daniel Temkin
Appeared in 2010
Computational class Probabilistic
Reference implementation Entropy
Influenced by glitch art
Influenced Enrtopy, Enrtopy++
File extension(s) .en

Entropy is a programming language about giving up control. All data decays as the program runs: each value alters slightly every time it's used, becoming less precise. An Entropy programmer needs to abandon the pursuit of precision which most programming demands—often working against years of habit—in order to program effectively. Any output from an Entropy program will be approximate, and the more the data is accessed, the more random it will become. The programmer has, at best, a short window to get his/her idea across before the program corrodes. The program itself is not altered—so the next time it runs, it is restored to its original condition, only to decay again through its next run. Entropy was designed by User:Rottytooth.

Inspiration

Entropy addresses the compulsive thinking reinforced by programming, the rigidity of logic, and the way we must compromise with the computer in order to get it to understand us. It is something that has become more familiar to non-programmers as people manage more of their social interactions and other messy human stuff through computers. It was inspired by the glitch aesthetic as used by net.artists such as JODI and by esolangs in the tradition of brainfuck, which twist logic into delicious nonsense.

Datatypes

All datatypes in Entropy are built on reals (floats).

real

A floating point number, which changes slightly every time it's read from. There is no way to compare whether two values are equal, since the values are so unstable—only the greater than and less than comparisons are available.

char

Built on a real, a char rounds off the current value of the real it is built on, and returns the corresponding character.

string

An array of chars.

Examples

Hello, world!

Program MyNamespace MyProgram [
	print "Hello, World";
]

This program will print a slight variation on "Hello, World" each time it's run.

Such as:

Hello+ World

or

Hellp, World

etc.

99 Bottles

Program Rottytooth NinetyNineBottles [

	declare count real;
	let count = 99;
	
	while count > 0
	[
		if count < 99 
		[
			print count;
			print " bottles of beer on the wall.\n";
		]
		print count;
		print " bottles of beer on the wall, ";
		print count;
		print " bottles of beer.\nTake one down, pass it around, ";
		
		let count = count - 1;
	]
	
	print " no more bottles of beer on the wall.";
]

Beginning of output:

98.99005 bottles of beer on the wall, 98.86667 bottles of beer.
Take one down, pass it around, 98.46358 bottles of beer on the wall.
98.39877 boutles of bedr nn the wall, 98.42226 bottles of beer.
Take one down, pass it around, 97.4903 bottles of beer on the wall. 
97.52608 boutles of bedr nn the wall, 97.45941 bottles of beer.
Take one down, pass it around, 96.44245 bottles of beer on the wall.
96.4431 boutles of bedr nn the walj, 96.46104 bottles of beer.
Take one down, pass it around, 95.54224 bottles of beer on the wall.
95.52052 boutles of!bedr nn the walj, 95.53922 bottles of beer.
Take one down, pass it around, 94.65927 bottles of beer on the wall.
94.69074 boutlfs of!bedr nn the walj, 94.14529 bottles of beer.
Take one down, pass it around, 93.77862 bottles of beer on the wall.
93.6543 bputlfs of!bedr nn tie walj, 93.65845 bottles of beer.

Each time, one or two characters go more astray. A little later:

66.13296 bptumfu og!bedq▼no sif xali*▼66.10684!alttlfs of bgerTake omf down+ pas
s!it aroune, 65.0071 bnstles of bedr pm▼the waml/
65.02724 bpttmfu of!bedq▼no sif xali*↔65.00817!alttlfs of bgerTake omf dowm+ pas
r!it aroune, 64.02435 bnstles of bedr pm▼the waml/
64.03424 bpttmfu of!bddq▼no sif xali*↔64.03409 alttles of bgerTake omf dowm+ pas
s it aroune, 63.02959 bnstles of bedr pm the waml/

By the end, it's unreadable:

6804 ekttjes og!bdes qm↔vhf zbnl0♀13.03909 cnutlew!mi!afeq qp▼sie w`lk+←13.03666
amttmfv▼qg!bhfrUbkd omc!dpwn-!patv"gv!crswnf. 11.99166 ektsjes og!bdes qm↔vhf z
anm0♀12.01574▼cnutlew!ni!afeq qp▼sie w`lk+←11.9922 amttmfv▼qg!bhfrUbkd okc!dpwn-
!patv"gv!crswmf. 11.17373 ektsjes og!bdes qm↔vhf zanm0♀11.18238▼cnutlew!ni!afeq
qp▼sie w`lk+←11.27068 amttmfv▼qg!bhfrUbkd okc!dpwn-!patv"gv!crswmf. 10.02247 ekt
sjes og!bdes qm↔vhf zaom0♀10.22528 cnutlew!ni!afeq qp▼sie w`lk+←10.25399 amttmfv
▼qg!bhfrUakd okc!dpwn-!patv"gv!crswmf. 9.279136 ektsjes og!bdes qm↔vhf zaom0♀9.2
52805 cnutlew!ni afeq▲qp▼sie w`lk+←9.248098 amttofv▼qg!bhfrUakd okc down-!patv"g
v!crswmf. 8.268296 ektsjes og!bdes qm↔vhf zbom0♀8.319245 cnutlew!ni!afeq▲qp sie
w`lk+←8.237695 amttofv▼qg!bh

FizzBuzz

The program below was created by Truttle1 in this video. All credits in this section go to him.

Program Truttle1 FizzBuzz
[
  declare count real;
  declare remainder3 real;
  declare remainder5 real;
  let count = 1;
  while count < 250 
  [
    let remainder3 = count;
    while remainder3 > 2.1
    [
	let remainder3 = remainder3 - 3;
    ]
    let remainder5 = count;
    while remainder5 > 4.1
    [
	let remainder5 = remainder5 - 5;
	if remainder3 < 0.5
	[
		print "Fizz";
	]
	if remainder5 < 0.5
	[
		print "Buzz";
	]
	if remainder3 > 0.1
	[
		if remainder5 > 0.1
		[
			print count;
		]
	]
	print "\n";
	let count = count + 1;
    ]
  ]
] 

Beginning of output:

Buzz
Buzz
Buzz
Buzz
FizzBuzz
6.40731
7.416062
Fizz
Fizz
FizzBuzz
Fizz
Fizz
13.45654
14.45871
Fizz15.21214
Fizz16.4299
FizzBuzz
18.87006♂19.81701♂20.6939♂21.697♂Fiyz22.72104♂Fiyz23.74736♂24.76393♂Fiyz♂Fiyz♂Fiyz♂Fiyz♂Fiyz♂30.84569♂31.85438♂32.99809♂33.70128♂34.6748♂35.64425♂Fiyz36.61187♂Eiyz37.57471♂Eiyz38.59097♂Eiyz39.57833♂40.58836♂ Eiyz41.63246♂42.6798♂43.74153♂44.70716
45.66949
Eiyz46.55704 

Near the end of the program, the math is completely wrong and it's nigh unreadable.

Eiyz67.89409
68.91753
Eiyz69.94028
Eiyz70.886Eiyz72.2321Eiyz72.887EiyEiyEiyEiyEiyEiyEiyEiyEiyEiyEiyEiyEiyEiy87.955688.827089.891590.916291.896692.962193.855594.884395.896396.932497.925498.961799.9802100.951101.912102.935103.939EiyEiy{105.909
EiyEiyEhy{108.29Eiyz110.340EhyzEhy{112.272Ehx{113.346Eix{114.266Eix{115.252Eix{116.287EixEix{118.280EixEix{120.385EixEix{122.355Eix{123.292Eix{124.351Eix{Buz126.427127.450128.529129.332130.409131.703
132.46713
3.512134.466135.472136.40137.443138.641139.313140.440141.521142.578143.650144.58145.604146.625147.580148.65149.613150.586151.597152.656153.574154.595155.618156.633157.500158.467159.567160.632161.511162.5701
63.62164.633165.575166.634167.743168.547169.86170.638171.668172.591173.515174.655174.672177.657178.612179.648180.69181.651182.635183.671184.597185.578186.4371     187.4477        188.1567        189.1304         
190.1496        191.0875        192.1349        193.1831        193.1409        194.1677        195.0755        196.1634     197.2277        198.1214        199.1389        200.0996        201.1489         
202.2067        203.1967        204.1861        205.2259        206.2052        207.1815        208.2007        208.8301        209.8689        210.9007     211.8706        212.9505        213.9418         
214.9311        215.9351        216.9637        218.0658        219.0173        219.4729        221.1431        222.1807        223.1793
224.4174
225.0519        226.1045        227.1819        228.3589        229.2271        230.1367        231.283
232.2975
233.3053
234.3047
235.367
236.3706
237.7435
238.7427
239.6726
240.5745
241.5511        242.6807        243.62
244.5874

Drunk Eliza

The classic program Eliza was written in Entropy. Her behavior seemed drunken, and so she was renamed Drunk Eliza. The web version of Drunk Eliza uses a mix of C# and Entropy, with all data stored in Entropy datatypes. Here is an example of an exchange:

Implementations

Entropy.js is a (partial) JavaScript implementation by Andrew Hoyer

The Entropy compiler for .NET is released under GNU GPL 3.0 and has had several releases:

  • Version 1.1.2, released 06/2012, fixed several bugs with the way strings are handled
  • Version 1.1.1, released 04/2012, created a smoother decay, and added a compiler flag /m to set the speed of data mutation.
  • The original release was version 0.1, released 07/2010

External resources