Re: bit of python help

2015-05-07 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: bit of python help

@Kyleman123, Modulo is a mathimatical term. It is the equivalent of a modulus, which is the base with respect to which a congruence is computed. It could also be The absolute value of a complex number. Either suits it. However, since were tlaking about both math, in the programming context it is a An operator placed between two numbers, to get the remainder of the division of those numbers.

URL: http://forum.audiogames.net/viewtopic.php?pid=215257#p215257




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-06 Thread AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector


  


Re: bit of python help

You could also look at iterators from itertoolsThey are objects you call next on and it will alternate between 1 and 2.for example:import itertoolsl = [player1, player2, player3]iter = itertools.cycle(l)for i in range(5):  print(next(iter))result:player1player2player3player1player2

URL: http://forum.audiogames.net/viewtopic.php?pid=215060#p215060




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector


  


Re: bit of python help

Oh sorry, the french word is modulo and I thought it was the same word Hm I didnt programed in python for more than a year, but when you want to play a turn, you play it, and at the end of the loop, before updating the player index (to know that you are playing the turn of the player 1 or 2), you do : current_player = (current_player+1) % player_nbplayer_nb being the number of players, current_player being the current player (the one which is playing). If you want to keep a track of the number of turns, you can keep a variable counting it. This way, the player which is playing is turn % player_nb .The module trick is assuming that the 0 result is for player 1, the 1 result for player 2, etc. Thats why it is so cool when it is used as the index of a list 

URL: http://forum.audiogames.net/viewtopic.php?pid=214515#p214515




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: bit of python help

hmm, im assuming by modulo you mean module?i understand i think, but could you provide an example?

URL: http://forum.audiogames.net/viewtopic.php?pid=214511#p214511




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector


  


Re: bit of python help

Oh sorry, the french word is modulo and I thought it was the same word Hm I didnt programed in python for more than a year, but when you want to play a turn, you play it, and at the end of the loop, before updating the player index (to know that you are playing the turn of the player 1 or 2), you do : current_player = (current_player+1) % player_nbplayer_nb being the number of players, current_player being the current player (the one which is playing). If you want to keep a track of the number of turns, you can keep a variable counting it. This way, the player which is playing is turn % player_nb .The module trick is assuming that the 0 result is for player 1, the 1 result for player 2, etc. Thats why it is so cool when it is used as the index of a list I dont remember if lists index begins at 1 or 0 in python, but if they begin with 1 the calcul is : current_player = ((current_player+1) % player_nb)+1, same thing for the calcul using the turn variable 

URL: http://forum.audiogames.net/viewtopic.php?pid=214515#p214515




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector


  


Re: bit of python help

Just a trick, instead of using a condition, you can use modulos You can also use players in a list, and ++ the index of this list for each turn, and again with a modulo to loop around it

URL: http://forum.audiogames.net/viewtopic.php?pid=214509#p214509




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


bit of python help

i am currently learning python. so as im getting fairly decent with it i thought it was time to start on a bit of a project. i am coding a monopoly game. this isnt really something i plan on releasing but if it turns out to be something really good, ill consider it.i have to major issues at this point. ive been working on a lot of the player methods currently. so here comes the questions.my board is a tuple i am using my player object instance attribute to move my to players along the board. however, once the number gets higher than the number of things in the board, 40, i get a tuple index is out of range error. how might a be able to loop it back and start again like the normal game loops around the board?secondly, are there any general practices to for alternating between players in a game? i kind of have something working in this regard, but it breaks half the time and thought Id ask here for any advice from any
  other more experienced pythonians.

URL: http://forum.audiogames.net/viewtopic.php?pid=214476#p214476




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector


  


Re: bit of python help

Hi,First, you might be able to catch it with a try: except clause, but there are probably better solutions out there.Second, could I please get the code?  itll really help me learn python more.

URL: http://forum.audiogames.net/viewtopic.php?pid=214483#p214483




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector


  


Re: bit of python help

Hi,First, you might be able to catch it with a try: except clause, but there are probably better solutions out there.Second, could I please get the code?  itll really help me learn python mre.

URL: http://forum.audiogames.net/viewtopic.php?pid=214483#p214483




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: bit of python help

ive seen try statements around and i had to look up specifically what they were and stuff. ill see what i can do with that.ill probably will eventually post my code, but its in no state to be shown to anyone. at this point, its split into several different files according to different parts of the game so i can run tests on new code easier. ill probably want to add comments and stuff before posting as well.

URL: http://forum.audiogames.net/viewtopic.php?pid=214498#p214498




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bit of python help

2015-05-01 Thread AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector


  


Re: bit of python help

well update time, it seems i am now able to loop around the board. yeah go me.a simple if conditional solved it. with a bit of math to manipulate the numbers a bit.but still dont really have a reliable way to switch players.im using an if block that if its player 1s turn, it changes it to player 2s. but the hang up, or at least part of it, is that the elif block is that if its player 2s turn it changes it to player 1s. and those execute if then elif. and player two doesnt actually get to take his turn.

URL: http://forum.audiogames.net/viewtopic.php?pid=214502#p214502




___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector