Re: bit of python help

Oh sorry, the french word is 'modulo' and I thought it was the same word smile

Hm I didn't 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_nb

player_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. That's why it is so cool when it is used as the index of a list smile

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : dhruv via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Genroa via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : frastlin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector

Reply via email to