At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
multiply both sides by k^2
how do u write K is a member of all positive integers
\[ k \in \Bbb Z^+ \]
U ARE A GOOD MAN
http://mathworld.wolfram.com/PythagoreanTriple.html eqation (10) and (11) is also useful
oh yes i was reading about that equation to find pythagorean triple on wiki
thats pretty cool, did u see the way the integer radius of the circles keeps giving integer solutions
not all ..
yeah i know but still
if your radius is a member of this sequence then it will give you integer solution. to say it more clearly, it intersects with lattice of coordinate other than (x,0) or (0,y)
are you good at programming too
if you have programming then you can post
okay well this is completely different from this question
when i use this code its giving me an error
i usually code in python
def diceanime(xpos,ypos): if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 return xposmove,yposmove if xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 return xposmove,yposmove if xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 return xposmove,yposmove if ypos<=50 and xpos>=750: yposmove=+1 xposmove=0 return xposmove,yposmove x,y=diceanime()
gives me this error Traceback (most recent call last): File "
", line 1, in
TypeError: 'NoneType' object is not iterable
x,y=diceanime(xpos,ypos) when i enter
xpos and ypos values are some random numbers between 50 and 750
x,y=diceanime() ?? where is your argument?
x,y=diceanime(50,700) lets just say this for now
hold on ill show you why this is relevant, you will probably give me a better solution than go about htis way
i should probably start putting this stuff in a file xD
can you look at my game though
right now i have this 1 single circle in a rectangle
going in circles
so how come elif fixes it?
seriously how do you play monopoly? i have no idea. elif is just else if. that would alleviate you from typing return on every statement.
monopoly is simple, u just roll the dice, and you land on these positions, and those positions have options thats about it
first i want to just have some rectangles spinning around this board
i would have loved to code this on web version than on python.
that idone place?
that is online compiler. I don't have graphics programming with python. i used to web developer. I use python for more like problem solving.
oh right, i forgot you have to have downloaded pygame too
yeah ... i have no experience with pygame class too.
oh man i cant figure out why its not working
where is your complete program?
i sent you that code up there
you want me to give you just the code instead
xpos=750 ypos=750 xposmove=0 yposmove=0 def diceanime(xpos,ypos): xposmove=0 yposmove=0 if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 elif xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 elif xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 elif ypos<=50 and xpos>=750: yposmove=+1 xposmove=0 return xposmove,yposmove xposmove,yposmove=diceanime(xpos,ypos)
this is the relevant part of that code
i meant i gave you the modified code ... didn't it work?
this is my moidified code
before this one, instead of having xposmove,yposmove i just have this
doesn't this work?
xpos=750 ypos=750 xposmove=0 yposmove=0 while True: if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 if xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 if xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 if ypos<=50 and xpos>=750: yposmove=+1 xposmove=0
what are you doing? how does it exit loop?
xpos=750 ypos=750 xposmove=0 yposmove=0 while True: xpos+=xposmove ypos+=yposmove if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 if xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 if xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 if ypos<=50 and xpos>=750: yposmove=+1 xposmove=0
oh this my whole while loop
this is always true, it never exits the loop
pygame.init() screen=pygame.display.set_mode((811,811),0,32) background=pygame.image.load(bif).convert() player_a=pygame.image.load(mif).convert_alpha() clock = pygame.time.Clock() xpos=750 ypos=750 xposmove=0 yposmove=0 xbound1,xbound2=600,520 ybound1,ybound2=51,40 menu=pygame.image.load(bif3).convert() while True: for event in pygame.event.get(): if event.type==QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: if event.key==pygame.K_m: menu=pygame.image.load(bif2).convert() if event.key==pygame.K_c: menu=pygame.image.load(bif3).convert() if event.key==pygame.K_1: cbl["dan"].menu() xpos+=xposmove ypos+=yposmove if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 if xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 if xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 if ypos<=50 and xpos>=750: yposmove=+1 xposmove=0 # if xpos>40 and xpos<50 and ypos<65 and ypos>40: # xposmove=0 # yposmove=0 screen.blit(background,(0,0)) screen.blit(menu,(560,113)) screen.blit(player_a,(xpos,ypos)) pygame.display.update()
this makes the image stored in player_a just go round and round the board
when they push the key 1, it will roll the dice in the background some game logic stuff, and it will return a position value that they landed on and the player_a image will stop on that spot on the board,
monopoly is freaking complicated http://www.wikihow.com/Play-Monopoly
can you do one thing? zip your whole file and upload it
i commented out the pygame stuff
try it out, this is the main command you can do right now, with no interface i want to adding interface to these commands
damn .. i need to install pygame first.
wait you can commen that stuff out for now
i thought i did maybe i didnt save it before i sent it lol
if you scroll down you will see #----pygame stuff -------- just select all that stuff under that comment and comment out
you can select it all click format button and select comment button
hold on a sec ... downloading pygame
so you like python huh :)
i liked doing the game logic part for this game, but not the best for writing graphics, i will probably try to write a more fun game something with a nice rolling background and dodging blocks and stuff lol, like mario, where i can actually see all the stuff that im doing on the pygame screen
i used to be web developer couple of years ago. http://stackoverflow.com/users/447023/experimentx these days i don't do any professional stuff. so have been using python to solve problem. usually from project euler.
im new to this stuff, its been fun
graphics programming is hard on python ... as well as on java or any other language. it's easier on web.
the most useful thing i learnt while coding this was.. i had a lot of variables, and i didnt wanna type a different variable name and assign a value to it, so i figured out that you can do it with dictionaries!! you can have a nice loop going where it will assign the dictionary variable you want and the object for a value in there.
python is lot cooler than other languages. usually takes less than half lines of code than rest of thoers.
the only other language i know is matlab
is it working now?
matlab is not flexible as python ... what i hate about it is it's string manipulation.
oh yeah true
you coded 300 lines of code. thats awful lot ... the code is not working well.
Enter player names, separated by spaces: "player_list" of player objects= [<__main__.player object at 0x024204B0>] MAIN COMMAND---->cbl["name"].menu()
whatever name you entered enter in that main command with the quotes
you will see a list of options you can do so far
first i want to implement that roll dice stuff for graphics
right now what roll dice does is rolls the dice, returns position you landed, on and promts you if you land on a place card, if u want to buy
if you say yes, your cash changes and you own that card object, and if anyone else lands on it you get rent for it
oh also it will check to see if you passed the starting position, and you get 200 extra money if u did
there are 40 positions on this board, 0-39 and, i didnt implement the actions for all the position, only the positions with the cards so far
hold on a sec ... let me reply someone first.
what do you do to render this graphics?
what do you mean
^---- dont forget you talking to big python noob
if u want to see what i have so far in terms of graphics
select that stuff under #-----pygame stuff here--------- and uncomment that part
i dont really have anything there yet, just a that rectangle going round and round and you can open and close menu with 'm' and 'c'
all the pygame stuff is at the very end
what i currently want is, to write a function, that will still keep the rectangle imagine going round and round
i am a noob too ... i usually use python to solve problems
so that i can create 2 or 3 more rectangles doing the samething, if i do that currently with the code i have, ill have like 30 lines, needlessly just with if statments
instead of writing monopoly ... why not try writing simple games first?? like tic tac toe or tetris
i was thinking of putting this tsuff on hold too lol, but I just wrote so much game logic it would be a waste to not solve a couple of these graphics problems here now
did u get the pygame running
take a look at it, it's probably something easy for you
I just need to replace this part of the code in the while loop if xpos>=750 and ypos>=750: ## xposmove=-1 ## yposmove=0 ## if xpos<=40 and ypos>=750: ## xposmove=0 ## yposmove=-1 ## if xpos<=40 and ypos<=50: ## xposmove=+1 ## yposmove=0 ## if ypos<=50 and xpos>=750: ## yposmove=+1 ## xposmove=0
with a function
just need to condense this code, because i will repeat this for xposmove1,xpos1 yposmove1,ypos1 xposmove2,xpos2 yposmove2,ypos2 xposmove3,xpos3 yposmove3,ypos3
for the other 3 rectangle images
in plain english, i need to this function to take in xpos and ypos as parameters and see if its on the bottom part of the board or left or top or right and if its on the bottom part it should move left if its left side it should move up if its top part of the board it should move right if its right side it should move down
hold on a sec ... I am getting indentation eroor
the function should return xposmove=-1 for left +1 for right yposmove=-1 for up and +1 for down
lemme recheck hopefully that commenting stuff didnt mess it up
fixed it ... I am getting this big window ... where veryghing is black
put the MPboard image picture
in the python folder
put everything in that monopoly folder into the python folder
all right ... thisis working
try press m and c
did u see the menu screen, dont bother entering in any of those numbers though none of that work yet
NOW LETSSS fix this!
you see the code with all those iff statments
how do i write a function to do the samething
this part if xpos>=750 and ypos>=750: xposmove=-1 yposmove=0 if xpos<=40 and ypos>=750: xposmove=0 yposmove=-1 if xpos<=40 and ypos<=50: xposmove=+1 yposmove=0 if ypos<=50 and xpos>=750: yposmove=+1 xposmove=0
what are you trying to do here?
basically i keep drawing the image of the monopoly board and the position of the image over and over in the while loop
the imagine of the rectangle i keep drawing at some xpos and ypos
every time in the while loop the xpos and ypos change depending on which side the rectangle is on the board
this part of the code above the if statments xpos+=xposmove ypos+=yposmove
now i want it to keep adding this xposmove and yposmove
but instead of writing those if statments below it i want a function statment there