Example #1
0
 def duplicate(self,number):
     if number>0:
         #print(self.size)
         borders=self.position+self.size
         sx,sy=self.size
         position=[rdt(0,sx//2),rdt(0,sy//2)]
         size=[sx//2,sy//2]
         #print(size)
         friction=self.friction
         entity=Rectangle(position=position,size=size,borders=borders,friction=friction,controllable=self.controllable)
         entity.duplicate(number-1)
         self.rectangles.append(entity)
Example #2
0
 def __init__(self, name="Room", circles_number=5):
     self.name = name
     self.factor = 1
     Lab.__init__(self, name)
     self.window.size = [1440, 900]
     self.window.fullscreen = False
     self.window.text_size = 20
     self.window.set()
     wsx, wsy = self.window.size
     v = 3
     self.entities=[Circle(
                         position=[rdt(0,wsx),rdt(0,wsy)],\
                         velocity=[rdt(-v,v),rdt(-v,v)],\
                         acceleration=[0,0],\
                         mass=rdt(1,100),\
                         borders=[[0,wsx],[0,wsy]]) \
                         for i in range(circles_number)]
Example #3
0
 def __init__(self):
     self.name = "Camera tests"
     Lab.__init__(self, self.name)
     wsx, wsy = self.window.size
     self.window.text_size = 30
     self.window.build()
     size = [wsx // 2, wsy // 2]
     position = [rdt(0, wsx // 2), rdt(0, wsy // 2)]
     borders = [0, 0] + self.window.size
     friction = 0.1
     entity = Rectangle(position=position,
                        size=size,
                        borders=borders,
                        friction=friction,
                        controllable=True)
     entity.duplicate(5)
     self.entities = [entity]
def genfilename(targetfile='hellomybabyhellomygirl', fileextension='.txt'):
    """ takes file name as first arg, the file extension as second arg
    if the file name is not give a default is given like wise a .txt 
    as the extention"""
    targetfile = list(targetfile + str(rdt(121, 2123)))
    shf(targetfile)
    targetfile = ''.join(targetfile) + fileextension

    return [targetfile, fileextension]
from random import randint as rdt, randrange as rdrg

print(rdrg(1, 100))
print(rdt(800, 8000))
Example #6
0
from random import randint as rdt
import myutil1 as m1
# 쉽게 쓸고
import myutil2

a = 100
b = rdt(1, 10)
print(a, b)
print(m1.sum(a, b))
print(myutil2.sum(a, b))
Example #7
0
from random import randint as rdt
from time import sleep as sp

itens = ('Pedra', 'Papel', 'Tesoura')
computador = rdt(0, 2)

print('''\033[37;1mJogadas:
[ 0 ] PEDRA
[ 1 ] PAPEL
[ 2 ] TESOURA''')

player = int(input('Escolha sua jogada: '))

print('\033[31;1mJO')
sp(1)
print('KEN')
sp(1)
print('PÔ\033[m')

print('\033[31;1m* \033[m' * 10)
print('O computador escolheu \033[1m%s\033[m!' % itens[computador])
print('Você jogou \033[1m%s\033[m!' % itens[player])
print('\033[31;1m* \033[m' * 10)

if computador == 0:  #PEDRA
    if player == 0:
        print('EMPATE!')
    elif player == 1:
        print('VOCÊ GANHOU DO COMPUTADOR!!! PARABÉNS!!!')
    elif player == 2:
        print('VOCÊ PERDEU...')
from random import randint as rdt
import sys

print(
    "This is an interactive guessing game!\nYou have to enter a number between 1 and 99 to find out the secret number.\nType 'exit' to end the game.\nGood luck!\n"
)
number = rdt(1, 99)
value = input("What's your guess between 1 and 99?\n")
if (value == "exit"):
    print("Goodbye!")
    sys.exit()
if (int(value) == number):
    print("Congratulations! You got it on your first try!")
    sys.exit()
loop = 1
while (1):
    if (value == "exit"):
        print("Goodbye!")
        sys.exit()
    elif (int(value) > number):
        print("Too high!")
    elif (int(value) < number):
        print("Too low!")
    elif (int(value) == number):
        print("Congratulations, you've got it!")
        if (int(value) == 42):
            print(
                "The answer to the ultimate question of life, the universe and everything is 42."
            )
        print("You won in " + str(loop) + " attempts!")
        sys.exit()
Example #9
0
from random import randint as rdt

contador = 0
numeros = (rdt(0, 10), rdt(0, 10), rdt(0, 10), rdt(0, 10), rdt(0, 10))

print(f'Os números sorteados foram: {numeros}')
print(f'O maior número sorteado foi o número {max(numeros)}')
print(f'O menor número sorteado foi o número {min(numeros)}')