Usr6 Posted February 7, 2014 Report Share Posted February 7, 2014 import randomimport sysimport osprint "Welcome to Rst roulette"print "Exit nr >7"nrales =0 while nrales <7: print "Please choose a nr from 1 to 6:" nrales = int(raw_input()) nrr = random.randrange(1,6) if nrales >=7: print "Seeya next time." sys.exit() elif nrales == nrr: try: os.system('shutdown -r -t 10 -c "You loose"') except Exception, e: print "Ai avut noroc de", Exception, sys.exit() else : print "Ai avut noroc, numarul era : %d, tu ai ales %d" %(nrr, nrales)Trebuie sa alegeti un nr intre 1 si 6, daca ghiciti nr ales aleator primiti ca premiu un restart al calculatoruluidaca alegeti un nr mai mare sau egal cu 7 iesiti din joc Quote Link to comment Share on other sites More sharing options...
yo20063 Posted February 7, 2014 Report Share Posted February 7, 2014 Cam mult 10 sec....are timp pentru un shutdown -a Quote Link to comment Share on other sites More sharing options...
Moderators Dragos Posted February 7, 2014 Moderators Report Share Posted February 7, 2014 (edited) E mai misto ruleta ruseasca.[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live"EDIT:[dandrei@192-168-0-104 ~]$ sudo [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live"[sudo] password for dandrei: You live Edited February 7, 2014 by Dragos Quote Link to comment Share on other sites More sharing options...
Usr6 Posted February 8, 2014 Author Report Share Posted February 8, 2014 Editie speciala pentru iubitorii de adrenalina, va sterge un fisier randomimport randomimport sysimport osprint "Welcome to Extreme Rst roulette"print "random file will be deleted"print "press 7 to exit"nrales =0 while nrales <7: print "Please choose a nr from 1 to 6:" try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,6) if nrales >=7: print "Seeya next time." sys.exit() elif nrales == nrr: try: print "You loose, un fisier va fi sters:" for root, subFolders, files in os.walk("C:\\"): for file in files: fullpath = os.path.join(root, file) noroc = random.randrange(0, 100) if noroc == 0: try: #os.remove(fullpath) print "Fisierul %s a fost sters." %(fullpath) sys.exit() except Exception, e: print "fisierul %s, nu a putut fi sters" %(fullpath) print e else: continue except Exception, e: print "Ai avut noroc de ", e sys.exit() else : print "Ai avut noroc, numarul era : %d, tu ai ales %d" %(nrr, nrales)Am avut "noroc" ))Welcome to Extreme Rst rouletterandom file will be deletedpress 7 to exitPlease choose a nr from 1 to 6:1You loose, un fisier va fi sters:Fisierul C:\IO.SYS a fost sters.Am lasat un mic 'anti noob' protectionNota: Stergerea unor fisiere de system poate duce la imposibilitatea de a porni pc-ul, aparitia BSOD-urilor, etc Quote Link to comment Share on other sites More sharing options...
Kalashnikov. Posted February 8, 2014 Report Share Posted February 8, 2014 daca am linux? Quote Link to comment Share on other sites More sharing options...
LLegoLLaS Posted February 8, 2014 Report Share Posted February 8, 2014 (edited) @Usr: daca ai ''avut noroc'' ,runda urmatoare fa-l sa aleaga doua (o sa incerc si eu sa modific codul) ,apoi 3,pana la 5.Ori suntem comisarul Moldovan, ori nu mai suntem? Edited February 8, 2014 by LLegoLLaS Quote Link to comment Share on other sites More sharing options...
Usr6 Posted February 11, 2014 Author Report Share Posted February 11, 2014 (edited) pe baza feedback-ului primit la versiunile anterioare, un nou release:5 runde pline de adrenalina, daca le treci iti raman fisierele intacte si primesti felicitarileWelcome to Extreme Rst roulette v2If you loose one random file will be deletedPlease choose a nr from 1 to 6 (choose 7 to exit):6Ai avut noroc, numarul era: 2, tu ai ales 6 Please choose a nr from 1 to 5 (choose 6 to exit):5Ai avut noroc, numarul era: 2, tu ai ales 5 Please choose a nr from 1 to 4(choose 5 to exit):3Ai avut noroc, numarul era : 4, tu ai ales 3 Please choose a nr from 1 to 3(choose 4 to exit):1Ai avut noroc, numarul era: 3, tu ai ales 1 Please choose between 1 and 2(choose 3 to exit):1numarul era: 2, tu ai ales 1 Felicitari!Game Over.daca nu... iti vei dori sa nu fi jucatWelcome to Extreme Rst roulette v2If you loose one random file will be deletedPlease choose a nr from 1 to 6 (choose 7 to exit):6You loose, un fisier va fi sters:Fisierul C:\boot.ini a fost sters.Script (python 2.7):import randomimport sysimport osprint "Welcome to Extreme Rst roulette v2"print "If you loose one random file will be deleted"def looser(): print "You loose, un fisier va fi sters:" for root, subFolders, files in os.walk("C:\\"): for file in files: fullpath = os.path.join(root, file) noroc = random.randrange(0, 100) if noroc == 0: try: #os.remove(fullpath) print "Fisierul %s a fost sters." %(fullpath) sys.exit() except Exception, e: print "fisierul %s, nu a putut fi sters" print e else: continuenrales =0 while nrales <7: print "Please choose a nr from 1 to 6 (choose 7 to exit):" try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,7) if nrales >=7: print "Seeya next time." sys.exit() elif nrales == nrr: looser() else : print "Ai avut noroc, numarul era: %d, tu ai ales %d \nPlease choose a nr from 1 to 5 (choose 6 to exit):" %(nrr, nrales) try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,6) if nrales >=6: print "Seeya next time." sys.exit() elif nrales == nrr: looser() else : print "Ai avut noroc, numarul era: %d, tu ai ales %d \nPlease choose a nr from 1 to 4(choose 5 to exit):" %(nrr, nrales) try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,5) if nrales >=5: print "Seeya next time." sys.exit() elif nrales == nrr: looser() else : print "Ai avut noroc, numarul era : %d, tu ai ales %d \nPlease choose a nr from 1 to 3(choose 4 to exit):" %(nrr, nrales) try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,4) if nrales >=4: print "Seeya next time." sys.exit() elif nrales == nrr: looser() else : print "Ai avut noroc, numarul era: %d, tu ai ales %d \nPlease choose between 1 and 2(choose 3 to exit):" %(nrr, nrales) try: nrales = int(raw_input()) except: print "Am zis numar, da?" nrr = random.randrange(1,3) if nrales >=3: print "Seeya next time." sys.exit() elif nrales == nrr: looser() else : print "numarul era: %d, tu ai ales %d \nFelicitari!\nGame Over." %(nrr, nrales) sys.exit()Am lasat un mic 'anti noob' protectionNota: Stergerea unor fisiere de system poate duce la imposibilitatea de a porni pc-ul, aparitia BSOD-urilor, etc Edited February 11, 2014 by Usr6 Quote Link to comment Share on other sites More sharing options...
Elohim Posted February 11, 2014 Report Share Posted February 11, 2014 Cred ca mai degraba se numeste Russian Roulette Quote Link to comment Share on other sites More sharing options...
LichValue Posted February 11, 2014 Report Share Posted February 11, 2014 Ar trebuii pus si un premiu, ca nah.... Quote Link to comment Share on other sites More sharing options...
MasterLight Posted February 11, 2014 Report Share Posted February 11, 2014 (edited) . Edited July 5, 2016 by MasterLight Quote Link to comment Share on other sites More sharing options...