Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

admasmaca oyunu
Thursday, December 18th, 2008 at 3:32:39am MST 

  1. # -*- coding: utf-8 -*-
  2. # adamasmaca şeysi
  3. # coded by rohanrhu@kubuntu 2008-11-04 saat 10:20 (sabah) suları...
  4.  
  5. from sys import exit, stderr
  6. from random import choice
  7. from time import time
  8.  
  9. # oyuna başlanılan zaman alınıyor...
  10. startTime = time()
  11.  
  12. # ASCII resimler...
  13. status = ['\n\n|\n|\n|\n|\n|\n -------\n', '\n -------\n|\n|\n|\n|\n|\n -------\n',
  14. '\n -------\n|    O\n|\n|\n|\n|\n -------\n',
  15. '\n -------\n|    O\n|    |\n|    |\n|\n|\n -------\n',
  16. '\n -------\n|    O\n|    |\n|    |\n|   |+|\n|\n -------\n',
  17. '\n -------\n|    O\n|  |+|+|\n|    |\n|   |+|\n|\n -------\n']
  18.  
  19. def index(a, b):
  20.     """ 1. arguman ı 2. arguman içinde arar ve,
  21.     kaçıncı elemanları oluduğunu liste halinde verir..."""
  22.     d = []
  23.     for i in range(len(a)):
  24.         try:
  25.             c = a.index(b, i)
  26.             if c not in d:
  27.                 d.append(c)
  28.         except: break
  29.     return d
  30.  
  31. def replace(a, b):
  32.     """Liste halinde ki index den alınan elemaanları tek tek değiştirir..."""
  33.     c = []
  34.     for i in a:
  35.         for f in b:
  36.             if i == f:
  37.                 c.append(f)
  38.         if i not in c:
  39.             c.append("-")
  40.  
  41.     d = ""
  42.     for i in c:
  43.         d = d + i
  44.     return d
  45.  
  46. def puts(w):
  47.     """Daha sonra gelişecek olan özel print :P"""
  48.     print w
  49.  
  50. def len_(a):
  51.     """Bir eleman cümle içersinde bir den fazla yer alıyor ise,
  52.     bu fonksiyon ile her eleman bir kere sayılıyor..."""
  53.     b = []
  54.     for i in a:
  55.         if i not in b:
  56.             b.append(i)
  57.  
  58.     return len(b)
  59.  
  60. # kelimeleri bu listeye ekleyin...
  61. words = ["linux", "kubuntu", "ubuntu", "pardus", "opensource", "acik kaynak"]
  62. word = choice(words)
  63.  
  64. pWord = "-" * len(word)
  65. tWord = []
  66. allPuts = []
  67. trues = 0
  68. healt = 0
  69.  
  70. # kelimede boşluk varsa boşluk tahmini yapılmış işlemi yapılıyor...
  71. if " " in word:
  72.     tWord.append(" ")
  73.     pWord = replace(word, tWord)
  74.  
  75.     trues += 1
  76.  
  77. while True:
  78.     # şuan ki zaman alınıyor...
  79.     nowTime = time()
  80.     t = nowTime - startTime # zamanların farkı...
  81.     t = int(t)
  82.  
  83.     pHealt = status[healt]
  84.     writing = "%(pHealt)s\n%(pWord)s" % vars()
  85.     puts(writing)
  86.  
  87.     if healt == 5:
  88.         puts("%s dakika %s saniye de Asıldınız!" % (t / 60, t))
  89.         break
  90.     if trues == len_(word):
  91.         puts("Tebrikler %s dakika %s saniyede, %s tahminde bildiniz..." \
  92.         % (t / 60, t, allPuts.__len__().__str__()))
  93.         break
  94.  
  95.     # eğer klavye kesmesi gelirse döngü "break" ile bitirilecek...
  96.     try: put = raw_input("Tahmininiz: ")
  97.     except: break
  98.  
  99.     # verilen yazının ilk elemanı boşluk mu diye denetleniyor...
  100.     try:
  101.         if (put == "") or (put[0] == " ") or (len(put) != 1):
  102.             # öyle ise sağlık azalmadan döngü yeniden başlıyor...
  103.             print "Geçersiz girdi... (boşluk yada tek karakter den fazla)"
  104.             continue
  105.     except: pass
  106.  
  107.  
  108.     # eğer bu tahmin daha önce yapılmışsa uyarı veriliyor ve döngü başa dönüyor...
  109.     if put in allPuts:
  110.         print "Bu tahmini daha önce yapmıştınız..."
  111.         continue
  112.  
  113.     # daha sonra denetlenmek için tahmin tüm girdilere ekleniyor...
  114.     if put not in allPuts: allPuts.append(put)
  115.  
  116.     if put in word:
  117.         tWord.append(put)
  118.         pWord = replace(word, tWord)
  119.  
  120.         trues += 1
  121.     else:
  122.         healt += 1
  123.  
  124. print "Oynadığınız için teşekkürler..."

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
worth-right