Howto GT-Native-003: Rock, Paper, Scissors

Executable code

## -------------------------------------------------------------------------------------------------
## -- Project : MLPro - A Synoptic Framework for Standardized Machine Learning Tasks
## -- Package : mlpro.gt.examples
## -- Module  : howto_gt_native_003_rock_paper_scissors.py
## -------------------------------------------------------------------------------------------------
## -- History :
## -- yyyy-mm-dd  Ver.      Auth.    Description
## -- 2023-12-08  0.0.0     SY       Creation
## -- 2023-12-12  1.0.0     SY       Release of first version
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.0.0 (2023-12-12)

This module shows how to run a duel of two coalitions of a game of Rock Paper Scissors.

You will learn:
    
1) How to set up a game, including solver, competition, coalition, payoff, and more
    
2) How to run the game

3) How to analyse the game
    
"""

from mlpro.gt.native.basics import *
from mlpro.gt.pool.native.games.rockpaperscissors import *
from pathlib import Path



if __name__ == "__main__":
    cycle_limit = 10
    logging     = Log.C_LOG_ALL
    visualize   = False
    path        = str(Path.home())

else:
    cycle_limit = 1
    logging     = Log.C_LOG_NOTHING
    visualize   = False
    path        = None

training = GTTraining(
        p_game_cls=RockPaperScissors,
        p_cycle_limit=cycle_limit,
        p_path=path,
        p_visualize=visualize,
        p_logging=logging
        )

training.run()

Results

YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Training "Native GT Training": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Game "RockPaperScissors": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Solver "RandomSolver": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 1 of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 1 of Team 1": Player 1 of Team 1 is keeping the same solver 1
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 2 of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 2 of Team 1": Player 2 of Team 1 is keeping the same solver 1
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 3 of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 3 of Team 1": Player 3 of Team 1 is keeping the same solver 1
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 4 of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 4 of Team 1": Player 4 of Team 1 is keeping the same solver 1
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 5 of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Player "Player 5 of Team 1": Player 5 of Team 1 is keeping the same solver 1
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Instantiated
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Player 1 of Team 1 added.
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Player 2 of Team 1 added.
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Player 3 of Team 1 added.
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Player 4 of Team 1 added.
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Coalition "Coalition of Team 1": Player 5 of Team 1 added.
...
YYYY-MM-DD  HH:MM:SS.SSSSSS  I  GT Training "Native GT Training": Training completed

Cross Reference