Du må være registrert og logget inn for å kunne legge ut innlegg på freak.no
X
LOGG INN
... eller du kan registrere deg nå
Dette nettstedet er avhengig av annonseinntekter for å holde driften og videre utvikling igang. Vi liker ikke reklame heller, men alternativene er ikke mange. Vær snill å vurder å slå av annonseblokkering, eller å abonnere på en reklamefri utgave av nettstedet.
  10 5165
Trigonoceps occipita
vidarlo's Avatar
Donor
Vi kjenner vel alle 99 bottles of beer?

99 bottles of beer on the wall, 99 bottles of beer.
Take one down, pass it around, 98 bottles of beer on the wall...
98 bottles of...
...
No more bottles of beer on the wall, no more bottles of beer
Go to the store and buy some more, 99 bottles of beer on the wall...
Vis hele sitatet...
Teksten er henta frå wikipedia, for å unngå trivielle diskusjoner om tekst.

Vi har vel alle laga ein variant av den, med ei for-løkke og litt plukk, men det må finnast fleire måtar å gjere det på? Kanskje artige måter, som ikkje er heilt opplagte? GPU-akslererte versjoner? Sure thing!

Print teksten på uvanlege måter. Korleis? Bruk fantasien din!

Det du lager bør køyre på debian stable amd64. Om du treng spesielle pakker, så inkluder ei liste, eller eit shellscript som, utført som root, installerer nødvendige ting. Shellscriptet kan godt hente ned ting som ikkje ligg i repositories og nytte det.

Og inspirasjon?

https://www.youtube.com/watch?v=Z7bmyjxJuVY
Sist endret av vidarlo; 20. august 2014 kl. 23:13.
Så basically free-for-all mtp. verktøy etc som benyttes så lenge det kjører på debian stable x64?
Trigonoceps occipita
vidarlo's Avatar
Trådstarter Donor
Sitat av hayer Vis innlegg
Så basically free-for-all mtp. verktøy etc som benyttes så lenge det kjører på debian stable x64?
Vis hele sitatet...
Jepp, så lenge du er i stand til å få det til å køyre på debian, og gir meg script for å få det til, så er det free for all.

Hald deg innen rimelegheita sine grenser. Å laste ned vmware og windows 7 er ikkje godtatt...
obligatorisk python-innlevering. Ikke så veldig krativ, men er i det minste en start

Kode

class Bottles:
    def __init__(self):
        self.str = None

    def done(self):
        print self.str
        self.str = ""
        return self

    def dot(self):
        self.str+="."
        return self

    def comma(self):
        self.str+=","
        return self

    def aw(self, w):
        if self.str:
            self.str+=" "+w
        else:
            self.str = w

    def __getattr__(self, name):
        def method(x=None):
            if x is not None:
                self.aw(str(x))
            else:
                self.aw(name)
            return self
        return method

for x in xrange(99, 0, -1):
    Bottles().x(x).bottles().of().beer().on().the().wall().comma().x(x).bottles().of().beer().dot().done()
    Bottles().Take().one().down().comma().Pass().it().around().comma().x(x-1).bottles().of().beer().on().the().wall().dot().dot().dot().done().done()

Bottles().No().more().bottles().of().beer().on().the().wall().comma().no().more().bottles().of().beer().dot().done()
Bottles().Go().to().the().store().And().buy().some().more().comma().x(99).bottles().of().beer().on().the().wall().dot().dot().dot().done()
sindre@puse.cat:~$
Synderen's Avatar
Tar litt tid å kjøre. Et lite stykke Python kode:

Kode

import thread
import time


def howmanybeers(beers, sleeptime):
    time.sleep(sleeptime)
    print("""
%d bottles of beer on the wall, %d bottles of beer.
Take one down, pass it around, %d bottles of beer on the wall...
     """
    %
    (beers, beers, beers - 1)
    )


for x in range(1, 100):
    thread.start_new_thread(howmanybeers, (x, 100 - x))

time.sleep(100)

print("No more bottles of beer on the wall, no more bottles of beer")
print("Go to the store and buy some more, 99 bottles of beer on the wall...")
Jeg valgte å gjøre det rekursivt i java. Programmets egentlige funksjon er å fylle opp stacken din.

Edit: Noe av teksten blir feil, selv om alt står korrekt inne i code tagsene.

Kode

public class bottles {

    //metoden beer er rekursiv og parametre er antall flasker og antall runder sangen skal printes ut.
    public static void beer(int n, int round){

        if (n > 0 && round > 0) {
            System.out.println(n + " bottles of beer on the wall, " +
                    n + " bottles of beer");
            n -= 1;
            System.out.println("Take one down, pass it around, " +
                    n + " bottles of beer on the wall" + "\n");
            beer(n, round);
        }

        else if (n == 0 && round > 0) {
            System.out.println("No more bottles of beer on the wall, " +
                    "no more bottles of beer");
            n = 99;
            System.out.println("Go to the store and buy some more, " +
                    n + " bottles of beer on the wall" + "\n \n");
            round -= 1;
            beer(n, round);
        }

        else {
            return;
        }
    }

    public static void main(String[]args){

        beer(99, 2);
    }
}
Sist endret av Dalla90; 22. august 2014 kl. 00:46.
Bruker Google image API,lager det så random bilder blir tatt ut etter søk på "beer"
Et bilde er en øl i koden,så et bilde blir fjernet i hver loop.
Mikser dette inn med tekst til 99 bottles of beer.

Bruker IPython Notebook,for og gjøre output mer interessant.
Kan anbefale og se IPython Notebook,
den kan kjøre mye mer enn bare kjøre Python kode F.eks alle Linux kommader,javaScript,bash,HTML,LaTeX,bilder,grafer i alle former.

Her er noen tester med 5 øl, beer_1, beer_2, beer_3, beer_4

Vanlig kode med bilde url lenker som output.

Kode

import os, sys
import time
from urllib import FancyURLopener
import urllib2
import json
import random

class MyOpener(FancyURLopener):
    version = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'

def find_beer_images(search_term,myopener,beer_count=50):
    '''Beer images generator'''
    count = 0
    search_term = search_term.replace(' ','%20')
    for beer in range(1, beer_count):
        url = 'https://ajax.googleapis.com/ajax/services/search/images?{}{}&start={}&userip=MyIP&imgsz=small'.\
        format('v=1.0&q=',search_term, random.sample(range(60),1)[0])
        #print url
        request = urllib2.Request(url, None, {'Referer': 'testing'})
        response = urllib2.urlopen(request)
        results = json.load(response)
        data = results['responseData']
        try:
            data_info = data['results']
        except:
            pass
        for myUrl in data_info:
            count = count + 1
            yield myUrl['unescapedUrl']
            myopener.retrieve(myUrl['unescapedUrl'],str(count)+'.jpg')

def collect_images(beer_images,number_of_beer):
    beer_lst = []
    for number,image in enumerate(beer_images,1):
        beer_lst.append(image)
        if number == number_of_beer:
            return beer_lst

def bottel_text(beer_lst,number_of_beer):
    for beer_count in range(number_of_beer-1, 0, -1):
       if beer_count > 1:
          print "{0} bottles of beer on the wall {0} bottles of beer.".format(beer_count)
          print '---'
          beer_lst.pop()
          img = '\n'.join(beer_lst)
          print img
          if beer_count > 2:
             beer_text = str(beer_count - 1) + " bottles of beer on the wall."
             beer_text = "{} bottles of beer on the wall.".format(beer_count - 1)
          else:
             beer_text = "1 bottle of beer on the wall."
       elif beer_count == 1:
          print "1 bottle of beer on the wall, 1 bottle of beer."
          last = beer_lst[-1]
          print last
          beer_text = "no more beer on the wall!"
       print '---'
       print "Take one down, pass it around,", beer_text

if __name__ == '__main__':
    myopener = MyOpener()
    search_term = "beer"
    number_of_beer = 6
    beer_images = find_beer_images(search_term,myopener)
    beer_lst = collect_images(beer_images,number_of_beer) #beer lst
    bottel_text(beer_lst,number_of_beer)
Output:

Kode

5 bottles of beer on the wall 5 bottles of beer.
---
http://1.bp.blogspot.com/-f-mCqbfCl5I/TeFGWs-v4XI/AAAAAAAAERY/4Czq2LkaA14/s1600/CoronaBeer2.jpg
http://4.bp.blogspot.com/_uJipGtg5L5Y/TPCYJIlZxqI/AAAAAAAAADU/ezXMnKSZuBA/s1600/Ginger+Beer+Can+Chicken+A+2010-11-17.jpg
http://2.bp.blogspot.com/_eDBIrz51HpI/S_C94ia9wsI/AAAAAAAAAgg/2bnFEXeBH64/s1600/Beer+Wall+Completion.jpg
http://2.bp.blogspot.com/-Q_Rsvcsau4o/TzNKNKehG4I/AAAAAAAACM8/dMIgQPZ8Hd0/s1600/Beer+Bread_0378.jpg
http://1.bp.blogspot.com/-0zHk7Y3GSb0/T7Qd5eMo18I/AAAAAAAACLY/aSvRW9cqQAQ/s1600/craft+beer+taps.jpg
---
Take one down, pass it around, 4 bottles of beer on the wall.
4 bottles of beer on the wall 4 bottles of beer.
---
http://1.bp.blogspot.com/-f-mCqbfCl5I/TeFGWs-v4XI/AAAAAAAAERY/4Czq2LkaA14/s1600/CoronaBeer2.jpg
http://4.bp.blogspot.com/_uJipGtg5L5Y/TPCYJIlZxqI/AAAAAAAAADU/ezXMnKSZuBA/s1600/Ginger+Beer+Can+Chicken+A+2010-11-17.jpg
http://2.bp.blogspot.com/_eDBIrz51HpI/S_C94ia9wsI/AAAAAAAAAgg/2bnFEXeBH64/s1600/Beer+Wall+Completion.jpg
http://2.bp.blogspot.com/-Q_Rsvcsau4o/TzNKNKehG4I/AAAAAAAACM8/dMIgQPZ8Hd0/s1600/Beer+Bread_0378.jpg
---
Take one down, pass it around, 3 bottles of beer on the wall.
3 bottles of beer on the wall 3 bottles of beer.
---
http://1.bp.blogspot.com/-f-mCqbfCl5I/TeFGWs-v4XI/AAAAAAAAERY/4Czq2LkaA14/s1600/CoronaBeer2.jpg
http://4.bp.blogspot.com/_uJipGtg5L5Y/TPCYJIlZxqI/AAAAAAAAADU/ezXMnKSZuBA/s1600/Ginger+Beer+Can+Chicken+A+2010-11-17.jpg
http://2.bp.blogspot.com/_eDBIrz51HpI/S_C94ia9wsI/AAAAAAAAAgg/2bnFEXeBH64/s1600/Beer+Wall+Completion.jpg
---
Take one down, pass it around, 2 bottles of beer on the wall.
2 bottles of beer on the wall 2 bottles of beer.
---
http://1.bp.blogspot.com/-f-mCqbfCl5I/TeFGWs-v4XI/AAAAAAAAERY/4Czq2LkaA14/s1600/CoronaBeer2.jpg
http://4.bp.blogspot.com/_uJipGtg5L5Y/TPCYJIlZxqI/AAAAAAAAADU/ezXMnKSZuBA/s1600/Ginger+Beer+Can+Chicken+A+2010-11-17.jpg
---
Take one down, pass it around, 1 bottle of beer on the wall.
1 bottle of beer on the wall, 1 bottle of beer.
http://4.bp.blogspot.com/_uJipGtg5L5Y/TPCYJIlZxqI/AAAAAAAAADU/ezXMnKSZuBA/s1600/Ginger+Beer+Can+Chicken+A+2010-11-17.jpg
---
Take one down, pass it around, no more beer on the wall!
Sist endret av snippsat; 22. august 2014 kl. 21:56.
Inspirert av entropi og poket av Slashdot legger jeg ut en tøysete Rubysnutt som lar PC'en simulere at den blir påvirket av alle disse ølene den drikker.
For annenhver øl blir en ekstra karakter i teksten byttet ut med et random tegn, noe som fort ender opp i kaos.
Innimellom klipper den linjeskift, men det bidrar vel egentlig bare mer til den kaotiske følelsen.

Kode

number_of_bottles = 99
iterations = 0
while true
while number_of_bottles > 0
	start_text = "#{number_of_bottles} bottles of beer on the wall, #{number_of_bottles} bottles of beer on the wall.
Take one down, pass it around, #{number_of_bottles-1} bottles of beer on the wall. \n"
	text = start_text.each_char.to_a
	
	(iterations/2).times do 
		replacement_letter = rand(26**1).to_s(26)
		text[rand(0..text.size)] = replacement_letter
		end

	print text.join
	number_of_bottles -=1
	iterations += 1
	sleep(0.1)
	puts "\n"
end
number_of_bottles = 99
print "No more bottles of beer on the wall, no more bottles of beer
Go to the store and buy some more, #{number_of_bottles} bottles of beer on the wall... \n \n".upcase
end
Output:
SPOILER ALERT! Vis spoiler

99 bottles of beer on the wall, 99 bottles of beer on the wall.
Take one down, pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer on the wall.
Take one down, pass it around, 97 bottles of beer on the wall.

87 bottles of beer on the wall, 97 bottles of beer on the wall.
Take one down, pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer on the wall.
Take one down, pass it around, 9j bottles of beer on the wall.

95 bottles of beer on the walli 95 bottles of beer on the wall.
Take one down, pass it around, 94 bottles of beer on the wall.
1
94 bottles of beer on the wall, 94 bottles of beer on the wall.
Take one down, 7ass it around, 93 bott1es of beer on the wall.

93 bottles of beer gn the wall, 93 bottles 2f beer on the wall.
iake one down, pass it around, 92 bottles of beer on the wall.

92 bottles of beer on the wallp 92 bottles of beer on the wall.
Take one down, pjss it arocnd, 91 bottles of beer on the wall.

91 bottfes of beerion the wall, 91 b3ttles of beer on t4e wall.
Take one down, pass it around, 90 bottles of beer on the wall.

90 bottles of beer on the wall, 90 bottles of bee6 on the wall.
Take pne dow2, pass it areund, 89 bottles of beer on the wall.

89 bottles of bler on the wall, 89 bottles of beer on the wall6
Take one down, pass i4 around, 88 b3ttaes of beer on the wall.

88 bottles of beer onmthe wall, 88 botkles2of beer on the wall.
Take one down, p8ss it around, 87 bottles o8 beer on the wall.

87 bottlep of bejr on the walo, 87 bottles of beer on the wall.
Take nnekdown, pass it around, 86 bottles of beer on the wall.j

86 bottles of beer onkthe wall, 86 bottles of beer on the wall.
pake one down, paas it around, di bottles of beer on ghe wall.

85 eotolesdof beer on the wall, 85 bottles of beer on the wall.
Take one down, pass it a4ound, 84 bottles of8be2r on the wall.

84 bottles of bee0 ob the wall, 84 bottles of beer on hhe wall.
Take one down, pass itbaround, 83 6ottlas of beerbon the wall.

83 b2tmles of beed on the wall, 83 bottles ofebeer on th6 wall.
T8ke one down, pass it around, 82 b5ttles af beer on the wall.

82 bottles of beer on0the wjhl, 82 bottles of beer on the wall.2Take one down, pass it around, 81 bottles of1beer on the wapl.o

81 bottles of beer on 6he wall, 80 bottles of beer on t4e wall.
Take kne dow9, pass it arognd, 80 bottles of 5eer on the wall.
o
80dbot4les of beerh3n the 0all, 80 bottles of neer on the wall1
Taka one down, pass it around, 79 bottles of beer on the wall.

89 bottlls of beer on the wall, 79 bottles of beer on thg well.
Take one down, pass it dfound, 78 bohtles of beer 4n the walja

78 bottles9of beeg onbthe wallc 78 bottles of b4er on the wall.
Take one down, p8sscit around, 77 bottles of beenkon the wallc

77 bottles of beer ln the wall, 77 boctle0 of beer on them4all.
Take one down, 1a4s it around, 76 b5ttle8 of beer en tha wall.

76 bottles of beer on thg wall, 76 dottles of beer on8thjmwall.
Take ene down, pass it around9 75 bottles of beer gn the waml.
gp
75 bottles of beer oo thp wadl, 757go0tles of beer onbthe wall.
Taee one down, pass it around, 74 pottles of beer on then5all.

74 bnttlep of beer on the wall, 74 bottles of bber on bhe wall.
Take one down, pass it aroa2d, 73 3ottles 4f beeb on the walk1

7f bottles of bebr on lhe wall, 733bottles of beer pn the wjll.
Taje one down, pass it nround5 72 bot7le2 of beer on the wa7l.
5
72 bottles og geer onamee wall, 72 bottleh of beer om the wallj
Take one75own, pass it 4round, 71 bottles of bejr on the walk.

71 bottlem o46b6er on the wpll, 71 bottles of be2r on the wall8
Take one dowk, pass it around, 70bbdttlhs of beer on the wall.
5
703bo6t8es of beer pd tme wall, 70 bottles of ceer on theowall.
Take one d1wn, pass it around, 69pbottles of beer 7n the wall.f

692bottles of bee1 o1 t3e wall,m69obot31es of beer oa the wall.
Take one down, pass io aroujd, 68 bottles6om beer on tbe wall.

6l bottles af beeg 3n the9wall, 68ebodtles of b7er 2n the7wall.
Tjke o3e down, pass it around6 67 bottl6s of beer on the wall.

67 boatle6 of neer omfthe walll 67 bottles of beer on tde1wall.oTape onb do4n, pass it around,566 bottlesiob beer on the wall.

66 kothles of beer on jhe wall, 66 bottles of beer on the wallo
Ta1e one down, pass it2aroun6, 65 bottles of leer7ii tie 6a0m.

65 bmtt5es of beer on4thehwdll, 65pbjttles oflbeer on the olll.
Take oneddown, pass it around, 64 botbles of be24 on tbe wall.

6f bottles ob bfeh on the walg, 64 nodtlee of beer ookthe wall.
Take one down, bass itharound, 63 bottles of feer on the wall.
h
63 bottles of beer on the walle 63 4ottleseo8 beer on bhe walg.
Take7one down, pa2s bt arouhd2 62 bottl6s of beer on tle wal6.

62 bottles of beelion phe wall, 622bottles of jeen on5the wall.
Taie obe7fohn, pkss it around, 517bo5tdes if beer on the wall.

de bottlls of ieer on the wall, 61 boitles of beer on t0e wall.
Take one dfwn2kpaif8it around,660dbattlls of beer on tme wall7

10 bottl2s of beer on the wall, k0 bottles6of2belr on3the wall.
iak5 mne down, pass it around6 59lbo3tges of beer on t6eo9all.g
d
59 bottles ofeb2er ondthe wall, 5o bot8les of l8e5 on tha wall.cT1me oneb6ow4, gass it around, 58 bot0lhs of beer on thebwall.

58 bottles of beer o4 the hkll,558 bottldd ooobeerdon the wall.0Ta8e one down, oass it arommd, 57 bo2tles of beerkin the wapll

i7 bottl7s of be7r on the wall, 57 bottlis o6 beerponptheowll3.mTage one dbwn, pass it or1und,je6 bottles lf beer on the wad6.

56 oopoles of beer on th1 wall, 59 bottles oc 4eee on the wall2
4ace one down, nass7im around, 55 bo1tles of 5eer oo bhe wall.
h
55 bottles of beer 97 the wall, 55 b72tles of peer on the w1lll4Take oee dow5, 85oliit around, 5e 1ottles of neer 7n kde6wall.

fo bottpns of bner on th91wall,25c boftles of beer on c3e walc.
Takg oke down, jass it around, j3 bottlesaof nenr 9n the wala.

53 bottles ol26eer on4the wa7l, 531bottles of 4eer on the16ale.
dake onemdown, pass itharkund, l2 b5ttles od beerdo0 tde wa0l.

59 bottlesmofofeer on ihe3waol, f26bottles of b0er on the wpjl.
Take one dewn, pass it around, 5m 4ogtles of ieea ongbh9 wlll.

h1 b1t29es om 3eer oj the wall, 51 bottlesifo beer on the wall.5Take cn8kdawn, 7ass it fround, 50 bottles of ifer on tfecwall.

5g b3ttles ofcbeer on the w0jl, h6ebottlel of b0er bn the w7li42Take one down, pas2 it ar1und, 4j bottl3s9of beer op tje wall. k
4i1bott1es of deer on thp wall,i40 botties 4f b0er 9n thp wall.
Take one deen, pass im2jround, 48 bo5ll4s of beer on bhe wal8.
g
48 bpt7n0s oj beer 6ndthm wall,a48 bottles of beer ah the wall9
Tage one cown, pass it arounb5 47jbothies of beer on the4wall.b
i
47 bnttles of behr oi thliwajl,447 bottles of bee6 of 1hd halla
k67e one oocn, pass it proubd, 46 bottles of beer o8kthe wal2. f
b2 bottles gf beer on thf 9all, 467bo1t1es oc beef on the pall.
Taae one down, pa1s it ar6u6e, 45 bohtled of bdp6 on thegwall.

45 a2ttles of beer mn the8w1ll6 d53boteles of ceer on the w3dl.
mbke one dokne p4ss 2t aj8une, 44 bottles of beerpon thj wall. 3
44 bottle8mof ce5r on the wal5, 44 blttles oa beeloon the walpg
Take 39e6dowil pass it around, 432eottles8ofobee1 on 9h3 wall. m0
43 i1ttfes of 6le8 d6 the wgll,9434b7ttles od beerio0mthe4wall.3Take onemdown, pass it bround,a42 bott4di of beer1on tie wall.

45 cottlef of neeg o5pthe wahl,842 bottles71p beer dn the wallj
Take one do1d, pass it ar8und6lp1 bmttlas9o3 b9e3 on the wall.

414eittlhs of beera6a the5wall, i1gbottlespof4o1er onithe wall.4Take jne down, pass it aroknd3 40 bat5les of 7eer on the1wallh o
40 bottles 5f beer on t3k w0ll, 304bjttkesbof9beer2on tlemgall.iTake one7dowi8 pass it aroun9, 39 5ottles ofbbeerdon 1he wa5l.7

39 b3ttles cf fedr on tha obll, 39 bottlesmof bgej on the wallg
Tc5e one daw4p pass it aro1nd, fb8pottles o6hbeer o7dmhe5wal9.5

3h bottles 4f g5ern8n th0 fbll, 3l bottles of bge4kon the 6all.
Tak8 one doln, pask6itiaround,532 bottles oflb9er on thegwall.9

37 aottles ofm1eer in the wh0m, 30 bottleslffkjeer on thm7wdll.kTake one ehwng pass itbaround, 36 hottle6 jf beer on ohllwall.

36 bottlescof beer on theawmll,m868botples o0 belr en the walp.
Te9e one down, kass ik a8ou49, 35cbntlles of b015 on thl walf.4

35pb2ttbbs of eeer dn jhe0wall, 32 bottlen of beer og the wlll.
Take on9 down, pass6it7aro7jm,dl4 bo3t1es of b4er onjtke wall7

34ibottlna o5 beerdon the wall,i34 bott0es om beer on the6w5l7.
Take ofe down, passa0t 7round, n3 97ttles 8f0blej onom9e hagl.p

db bo3tles of bee4 o0 tee w4dl, 33 bott30s1ofobeer on the wall.
Takecone dpwnl pass bt 9liund, 325oottles oi 41e4 on the walg. g3
32 bottle0iif beer9o3 7he walgd 62cbot1les on beer5oi khm wall.p1ake one dagn, pass j1 aroun6, 313bottdes o9 bee3 on the pa2l.e

31 botnlei of beer8on the wall, 710i4ttlds of beep6on the wald.
T3ke9onc dewn2ppasc it kround, 3d 3ottle3 of beer on the wadl20lg
30 bo8tles hfk5eebbon the willb 3f c7ttles ocebeen 1nifhnbwall.
Tak8 one downi passi7t 2foundhl29 bontles of beer on to9 wall.

29 bottles offb0er on mh2 mkbl1 29 bott3es of bjer on th2 wall.nTafe one down, passjit akound,52j b0ttle3 6f bperaon04he whll8g

c8 bottoes of9beer on t49fwall,f28 boitles of beer on the 11lf.
T5kk1oge5dow9, p7ss it aropnd, 57abot0lls o2 beerio2ath0 wall.7c
2m bottles464f6eer o7 tke wall,f21 lottljs of0beer 9n tbg wa3l.
Taj7 pneidonn, pass itmaround, 26ooottles of bee5 oi the well4 d
46 b5ttoh8lop bee8 on the wnl6, p6 5ottles of beer on the wall.
Take onhldown,ppabsfit eioumd, 25eboatlgs ofkbee2don themjalj.
d
25 bott3es of feer 1c nhe 3oll, 25 bot0le23oi beer on1teebpaol6
Take o0e edgn,p6a6s i7 8rmu8d, 24 b6ttles of beer on th9a3agl.8

24 1ottl6skof b3ar 6h thehw0ll7 a4 bottbeshaf mler on the fall.
Tok1 one down,4pass it oroun3, 2n7bigtges 4f bee9 o7 lheh2all.

37 bfltle2 oflbeer nn thk1wall, 23 dottles of bedr on t5k5dallo
Tpkejo9e bown, aass it 3round, 22 bettles1of beer 0nath2 wali. 1
22 b0tt93s of de6r g9 kje wace, 22fbcftles of beer9on2noehwall.
Tbke one 0own, pa8s37t 8roun8, 21 bobtles oh neer82n ihe wall.

21 5ootlekiof beerom1 tie wah1j 2hfbohtlds oeabeprfon dhe7walm.
T4kb 1ne0dowdj pass it aroukd, 2o bottles of b2er on the6waol.

40 bott7ecnof beer mn phe2walbh 23 botobes2of beerpon fdn wall.
Tak6 one down, pass 8t arouadk 19 bf7tlib of bedb o1 2he wall.

1a bot5hes8ofopeer on t6e8wafl, 19gbotmle56dfbb0er on the wall.
Take0one dn6n, 2ass9itiaround9a1k bbttlfg ofpboer63n 1ge5waa5p

189bottmes of neerf0n t8k6wakl, 1i bcntlej6l3 be3r oi the wall.
Take one downoo2ass a2 acound5a1l bottl0s o0 peer1on the 0a4l.fc
1f2b2ttlei o7 piej on thm w0ll, 4k ao7tles4j57beer on t2o 9al0.
4ake 1nbodown, pks6 it ar73np, 16 bottl2s oe beer onatpe hall2 l
16 b0ttdes 2fageer oa thj3fall, 16 6ottlmsn3fmceer o0 cha wall.oTake one1dohn, gas3 i72arouoc, 15cbkttles mf becr onj8he 9al0m

i5 b6etle2 of b4n70o3 the 0all,195 bop8ees682 me1r on t4e2wall.
4geo one doenb pass it around, 14 klttlos kd beer bn 8he wdl3.

14 bmttles of ieeg on jhe wabl, jm bchtles oh b2er on thejwallm
4ake one3dokn245ass3hthafound, 11k3ontces f9 be58 cn thehwall.
5
1d8bottles lf beerho6 the wal6, g6 bottiis of behf om 4h355alm.1Teke one 8own,lpass itlag49nd6 120bo4t1eb of8b1eg onothk 4al8.g

720eottleskifhbeer6on tho wall,io2 botoles of beer on 8he wa01.
Take pne dowj, passnit ground, 3k kdtflesaof beer 97 khe kalla e
1k bottleb of 5eel 9iithe wal3, 11 bottkes1li bjer pn theiwa7k.
ma2e on1 9o51,jpass it areu5d, 1phbottles bf 0depi9n tha wall.

10 botalise8f bee2 on the wallm 10 moftles ofnb7er oe tfe walh1
0h0e ine kh58, p49s 01 cropnd,09 j64ples ofmbe3rnod thp c1ll.

98bo9t5esdog beer onbt2elpall, f bohtles o3 geer on 1he walla
Takeeope bowao passmiopar2une, 8 hditlls 670bgl6 nn t88 wail.

1 boille5 of4be6r onoth7 dclc, 8amotd1e59of 66erkon the 2amj.
Takelone do5n, pdss ia mroun3, 7 b7ttces fa beer oncthe will. o
cobh9tles of 6eer om ph4 jagl, 7 botilks ofnbeermon theowalj.
Td9e one do5n, pnss 6n3aroi0d, 6dbeltges df be6rbdi lhe wall. nk
6gbot1l1s 92 benj2opfth47wall, labo5t8e8 of beed ni 4he86all.2Tek7 one down, 1ais otnaround, 5 bot4lfs ofl4oee of 5cepwa2l.

kcdottlfs af be98 on tha 4all, kbaott2es o0 beer8op thelwallomTjke 0ne down, pads it ajounee 4 iotdles ifgbcer dn the wall. 416
4 bot2lep92f b9ebnongthe wall, 2 botth7s of75eer onbtne002ll.1Take1oneliown2 pgss6il3amound7 3 botile9 2nfbeek1o9kthe wjll.
9a
3 0h4tdcp ol9b9er2fn tcnkwa1l, 3 bottles4mf beer on the w3nbp
Ta8a on0 dom4, pass1in pround0 d bottle9 om 7eer mn thehwall.k2
2 boe6lescdf kepr on7the waib, 2 co5cl9n 0f beeraodeoho wall.
fake onebd8wn,72asso43 aro7nd, o bpttn2s of bee6 onf7l91wanl. i6
1 4ottlhhgoffbei3 dn th5mwall7 1p7ogile9 o0 ba6r on the waml.
Takhionm2downb p91s it iround, iikottohs 8f bg2r oj nheioal2.

NO MORE BOTTLES OF BEER ON THE WALL, NO MORE BOTTLES OF BEER
GO TO THE STORE AND BUY SOME MORE, 99 BOTTLES OF BEER ON THE WALL...
Siden ingen andre har steppet opp i mellomtiden legger jeg ut enda et bidrag, som er relatert, selv om det ikke er helt innenfor.
Inspirert av programmet jeg leverte i går, har jeg videreført datakorrupsjon til en bildefil.
Jeg åpner et bilde som tekst, og kjører samme tilfeldige erstatning som øker i omfang etter hvert, og lagrer den så.
Det er vanskelig å beregne graden av korrupsjon på resultatet, så det blir litt hipp som happ, men jeg synes det ga et morsomt resultat i alle fall.
Siden dette ikke blir et ordentlig bidrag som Slashdot gidder å sjekke selv, viser jeg resultatet ved skjermkasting av et preview i Finder mens programmet kjører.
Jeg håper dere klarer å se hva som foregår om dere skrur på HD.

Kode

number_of_tabs = 99
iterations = 0

original_image = File.open('bilde.jpg', 'rb') { |io| io.read }

while true
while number_of_tabs > 0
	text = "#{number_of_tabs} tabs of acid in the pocket, #{number_of_tabs} tabs of acid in the pocket.
Take one out, pass it around, #{number_of_tabs-1} tabs of acid in the pocket. \n\n\n"
	manipulated_image = original_image.each_char.to_a

	
	(iterations/2).times do 
		replacement_letter = rand(26**1).to_s(26)
		manipulated_image[rand(0..manipulated_image.size)] = replacement_letter
		end
	File.open("bilde2.jpg", 'w') {|f| f.write(manipulated_image.join) }
	print text
	number_of_tabs -=1
	iterations += 1
	sleep(1.5)
	puts "\n" * 5
end
number_of_tabs = 99
print "No more tabs of acid in the pocket, no more tabs of acid
Go to the store and buy some more, #{number_of_tabs} tabs of acid in the pocket... \n \n".upcase
sleep(100)
end
Video av en gjennomkjøring.
m0b
m0b's Avatar
DonorAdministrator
Quickie i C#. Ett statement. Legg til ref System.Speech. Build. Run. Ha på lyd.

Kode

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _99_bottles_of_m0b
{
    class Program
    {
        static void Main(string[] args)
        {
            Enumerable.Range(0, 100).Reverse().ToList().ForEach(i => new System.Speech.Synthesis.SpeechSynthesizer().Speak(string.Format(i > 0 ? "{0} bottles of beer on the wall, {0} bottles of beer.\nTake one down, pass it around, {1} bottles of beer on the wall..." : "No more bottles of beer on the wall, no more bottles of beer.", i, i - 1)));
        }
    }
}
Repo: https://bitbucket.org/kenwi/99-bottles-of-m0b
(~1 minutt) Video: http://youtu.be/bF5ajnkxH-8
Sist endret av m0b; 30. august 2014 kl. 05:18.
haskell:

Kode

let b x = (case x of 0 -> "no more bottles" ; 1 -> show x ++ " bottle" ; _ -> show x ++ " bottles") ++ " of beer" ; c = (++ " on the wall") . b in forever $ mapM_ putStrLn [c x ++ ", " ++ b x ++ ". " ++ (if x == 0 then "go to the store and buy some more, " ++ c 99 ++ "." else "take one down, pass it around, " ++ c (x - 1) ++ ".") | x <- [99, 98 .. 0]]