This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - ruler501
Pages: 1 ... 131 132 [133] 134 135 ... 184
1981
« on: May 10, 2011, 12:52:40 am »
Sounds great but hard to implement.
I believe tiers would be the right word in that case
1982
« on: May 09, 2011, 06:55:38 pm »
How do you get the PHP images?
1983
« on: May 09, 2011, 06:23:45 pm »
This is much better than I could do. Let me ask someone I know if I could post some of their artwork here. It has much cartoon violence though
1984
« on: May 09, 2011, 06:11:28 pm »
The CAS is banned and the PTT mode disables OSLauncher so there is no way to get a CAS clac into a test if the people check your calc and do what they're supposed to.
1985
« on: May 09, 2011, 06:05:12 pm »
Its over 9000 for most recent months alone
1986
« on: May 09, 2011, 05:57:17 pm »
When I look the CAS is more expensive. I know the CAS prototypes are less expensive but why would you want one of those?
1987
« on: May 09, 2011, 01:23:05 pm »
For people in the US that looks very counter intuitive.
1988
« on: May 09, 2011, 01:21:34 pm »
Oh. In the Us we use it to separate powers of 1000. that was why I was so confused.
Why are things like that not standardized?
1989
« on: May 09, 2011, 01:16:20 pm »
I thought it was in total what does this not count?
what should be different *ruler confused
1990
« on: May 09, 2011, 01:14:26 pm »
Why not just get the regular and load CAs on it if you need it. They have OSLauncher and a tutorial on how to do it.
I'm thinking about doing thta to mine so I can do some of the math it lets me do.
1991
« on: May 09, 2011, 01:12:07 pm »
thats supposed to be 121.45749 right? If not that is kind of scary because it is even more than DJ's
1992
« on: May 09, 2011, 01:04:45 pm »
Wow 120,000 posts. How many posts is that per member?
This community is really doing well it seems
1993
« on: May 09, 2011, 08:28:24 am »
What did you change other than the imports?
Here is my new code with what you suggested done.
import sys import os import pygame import random from math import * from pygame.locals import *
#Check to see if pygame is working right #check font if not pygame.font: print 'Warning, fonts disabled' #check sound if not pygame.mixer: print 'Warning, sound disabled'
minimum=12.17 maximum=17.43
def calc_amount(doubling): newval=2 rate=log(2)/doubling valueatpoint=[2,] num=0 while newval<limit+.5: newval=eval('2*'+str(e)+'**(num*rate)') valueatpoint.append(newval) num+=1 return valueatpoint
#functions to create our resources def load_image(name, colorkey=None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot load image:', fullname raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect()
def load_sound(name): class NoneSound: def play(self): pass if not pygame.mixer or not pygame.mixer.get_init(): return NoneSound() fullname = os.path.join('data', name) try: sound = pygame.mixer.Sound(fullname) except pygame.error, message: print 'Cannot load sound:', fullname raise SystemExit, message return sound
class Hydra(pygame.sprite.Sprite): """creates a Hydra on screen""" def __init__(self,parentx,parenty): pygame.sprite.Sprite.__init__(self) #call Sprite initializer randint=random.randint(1,100) if randint%2==1: self.image, self.rect = load_image('hydraA.bmp', -1) else: self.image, self.rect = load_image('hydraB.bmp', -1) self.rect.topleft=parentx,parenty self.xvel=1 self.yvel=1 self.xdir=1 self.ydir=1
def update(self): if self.rect.left<1: self.xdir=1 self.xvel=4 elif self.rect.top<1: self.ydir=1 self.yvel=4 elif self.rect.right>screen.get_size()[0]: self.xdir=-1 self.xvel=-4 elif self.rect.bottom>screen.get_size()[1]: self.ydir=-1 self.yvel=-4 randint=random.randint(1,120) if randint%5==4: newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==3: xvel=1*self.xdir yvel=1*self.ydir newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==2: xvel=1*self.xdir yvel=1*self.ydir newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==1: xvel=-1 yvel=0 newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==0: xvel=0 yvel=-1 newpos=self.rect.move((self.xvel,self.yvel)) else: newpos=self.rect.move((0,0)) self.rect=newpos
def begin(): curamount=2 newamount=2 turn = 0 rounds=0 while 1: #use the clock clock.tick(days) turn+=1 if turn%5==0: rounds+=1 if rounds>len(amount)-1: print rounds final = "It took the Hydra "+str(rounds)+" days to get to "+str(limit)+" from 2" text = font.render(final, 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(2500) pygame.quit() return newamount=int(amount[rounds]) if newamount>curamount: hydras.append(Hydra(random.randint(2,screen.get_size()[0]),random.randint(2,screen.get_size()[1]))) hydras[len(hydras)-1].add(allsprites) curamount=newamount for event in pygame.event.get(): if event.type == QUIT: pygame.quit() return elif event.type == KEYDOWN and event.key == K_ESCAPE: pygame.quit() return allsprites.update()
#Draw Everything screen.blit(background, (0, 0)) allsprites.draw(screen) pygame.display.flip()
def prep(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type in on the numpad the apropriate speed and then press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
def preps(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type on the numpad the apropriate days a second and press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
def preeps(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type on the numpad the number of hydras to go to and press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
font = pygame.font.Font(None, 24) if __name__ == "__main__": #Initialize Everything pygame.init() screen = pygame.display.set_mode((1200, 700)) pygame.display.set_caption('Hydra Attack') pygame.mouse.set_visible(0) hydraA=Hydra(random.randint(1,100),random.randint(1,100)) hydraB=Hydra(random.randint(101,200),random.randint(101,200)) #Create The Backgound background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((250, 250, 250)) safebackground=background.copy() #Display The Background screen.blit(background, (0, 0)) pygame.display.flip() #Prepare Game Objects clock = pygame.time.Clock() hydras=[hydraA,hydraB] allsprites = pygame.sprite.RenderPlain((hydraA,hydraB)) doubling=float(prep()) background.blit(safebackground,(0, 0)) while doubling<minimum or doubling>maximum: text = font.render("Please type in the number between "+str(minimum)+' and '+str(maximum)+'.', 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) doubling=float(prep()) background.blit(safebackground,(0, 0)) days=int(preps()) background.blit(safebackground,(0, 0)) while days<1 or days>15: text = font.render("Please type in the number between 1 and 15.", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) days=int(preps()) background.blit(safebackground,(0, 0)) limit=int(preeps()) background.blit(safebackground,(0, 0)) while limit<5 or limit>250: text = font.render("Please type in the number between 5 and 250.", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) limit=int(preeps()) amount=calc_amount(doubling) days=days*4 background.fill((0,0,255)) begin()
1994
« on: May 09, 2011, 07:47:20 am »
Lionel do you mean 3.x?
Would this be made so that code from 3.x Lua?
1995
« on: May 09, 2011, 07:37:44 am »
My math teacher decided we needed to learn about evasive species and how species grow exponentially so I was given this project. I needed to give a presentation on how hydra increase. At first I thought this was going to be easy procrastinated for a while. As the deadline got closer I started working on a function evaluater(not sure if this is what it would be called). I eventually found out(night before it was originally due) that this was not going to get done in time so I googled a python module to do it for me. I stayed up to 3 am because my computers kept having problems. It turns out I had stumbled onto one of the few errors in linux mint that makes it impossible to access any of the HDDs including flash drives. I finally managed to finish it and bug check it in time for it to be turned in. When I got to math the next day my Algebra teacher had something come up so he had to leave and are projects were not due till Monday. I added a few touches Sunday night/Monday morning and here is my final project. I don't think this is too bad for whipped up in two nights while having computer problems.
Its written in python and made to run with pygame. It should theoretically be able to work on any computer OS.
import sys, os, pygame,random from math import * from pygame.locals import *
#Check to see if pygame is working right #check font if not pygame.font: print 'Warning, fonts disabled' #check sound if not pygame.mixer: print 'Warning, sound disabled'
minimum=12.17 maximum=17.43
def calc_amount(doubling): newval=2 rate=log(2)/doubling valueatpoint=[2,] num=0 while newval<limit+.5: newval=eval('2*'+str(e)+'**(num*rate)') valueatpoint.append(newval) num+=1 return valueatpoint
#functions to create our resources def load_image(name, colorkey=None): fullname = os.path.join('data', name) try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot load image:', fullname raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect()
def load_sound(name): class NoneSound: def play(self): pass if not pygame.mixer or not pygame.mixer.get_init(): return NoneSound() fullname = os.path.join('data', name) try: sound = pygame.mixer.Sound(fullname) except pygame.error, message: print 'Cannot load sound:', fullname raise SystemExit, message return sound
def engine(): pass
class Hydra(pygame.sprite.Sprite): """creates a Hydra on screen""" def __init__(self,parentx,parenty): pygame.sprite.Sprite.__init__(self) #call Sprite initializer randint=random.randint(1,100) if randint%2==1: self.image, self.rect = load_image('hydraA.bmp', -1) else: self.image, self.rect = load_image('hydraB.bmp', -1) self.rect.topleft=parentx,parenty self.xvel=1 self.yvel=1 self.xdir=1 self.ydir=1
def update(self): if self.rect.left<1: self.xdir=1 self.xvel=4 elif self.rect.top<1: self.ydir=1 self.yvel=4 elif self.rect.right>screen.get_size()[0]: self.xdir=-1 self.xvel=-4 elif self.rect.bottom>screen.get_size()[1]: self.ydir=-1 self.yvel=-4 randint=random.randint(1,120) if randint%5==4: newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==3: xvel=1*self.xdir yvel=1*self.ydir newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==2: xvel=1*self.xdir yvel=1*self.ydir newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==1: xvel=-1 yvel=0 newpos=self.rect.move((self.xvel,self.yvel)) elif randint%5==0: xvel=0 yvel=-1 newpos=self.rect.move((self.xvel,self.yvel)) else: newpos=self.rect.move((0,0)) self.rect=newpos
#Initialize Everything pygame.init() screen = pygame.display.set_mode((1200, 700)) pygame.display.set_caption('Hydra Attack') pygame.mouse.set_visible(0) hydraA=Hydra(random.randint(1,100),random.randint(1,100)) hydraB=Hydra(random.randint(101,200),random.randint(101,200)) #Create The Backgound background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((250, 250, 250)) safebackground=background.copy() #Display The Background screen.blit(background, (0, 0)) pygame.display.flip() #Prepare Game Objects clock = pygame.time.Clock() hydras=[hydraA,hydraB] allsprites = pygame.sprite.RenderPlain((hydraA,hydraB))
def begin(): curamount=2 newamount=2 turn = 0 rounds=0 while 1: #use the clock clock.tick(days) turn+=1 if turn%5==0: rounds+=1 if rounds>len(amount)-1: print rounds final = "It took the Hydra "+str(rounds)+" days to get to "+str(limit)+" from 2" text = font.render(final, 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(2500) pygame.quit() return newamount=int(amount[rounds]) if newamount>curamount: hydras.append(Hydra(random.randint(2,screen.get_size()[0]),random.randint(2,screen.get_size()[1]))) hydras[len(hydras)-1].add(allsprites) curamount=newamount for event in pygame.event.get(): if event.type == QUIT: pygame.quit() return elif event.type == KEYDOWN and event.key == K_ESCAPE: pygame.quit() return allsprites.update()
#Draw Everything screen.blit(background, (0, 0)) allsprites.draw(screen) pygame.display.flip()
def prep(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type in on the numpad the apropriate speed and then press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
def preps(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type on the numpad the apropriate days a second and press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
def preeps(): font = pygame.font.Font(None, 40) rate='0' while 1: clock.tick(15) for event in pygame.event.get(): if event.type == QUIT: return rate elif event.type == KEYDOWN: if event.key == K_ESCAPE: return rate elif event.key==K_KP0: rate+='0' elif event.key==K_KP1: rate+='1' elif event.key==K_KP2: rate+='2' elif event.key==K_KP3: rate+='3' elif event.key==K_KP4: rate+='4' elif event.key==K_KP5: rate+='5' elif event.key==K_KP6: rate+='6' elif event.key==K_KP7: rate+='7' elif event.key==K_KP8: rate+='8' elif event.key==K_KP9: rate+='9' elif event.key==K_KP_PERIOD: rate+='.' elif event.key==K_KP_ENTER: return rate text = font.render("Please type on the numpad the number of hydras to go to and press enter", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip()
font = pygame.font.Font(None, 24) doubling=float(prep()) background.blit(safebackground,(0, 0)) while doubling<minimum or doubling>maximum: text = font.render("Please type in the number between "+str(minimum)+' and '+str(maximum)+'.', 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) doubling=float(prep()) background.blit(safebackground,(0, 0)) days=int(preps()) background.blit(safebackground,(0, 0)) while days<1 or days>15: text = font.render("Please type in the number between 1 and 15.", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) days=int(preps()) background.blit(safebackground,(0, 0)) limit=int(preeps()) background.blit(safebackground,(0, 0)) while limit<5 or limit>250: text = font.render("Please type in the number between 5 and 250.", 1, (10, 10, 10)) textpos = text.get_rect(centerx=background.get_width()/2,centery=background.get_height()/2) background.blit(text, textpos) screen.blit(background, (0, 0)) pygame.display.flip() pygame.time.delay(1500) background.blit(safebackground,(0, 0)) limit=int(preeps()) amount=calc_amount(doubling) days=days*4 background.fill((0,0,255)) begin() To run it put it on any folder on your computer and make a folder under that named data. put the hydra images in data. I'll attach a video of it later.
Pages: 1 ... 131 132 [133] 134 135 ... 184
|