public BoardRepresentation(GammonInterface game) { if (game != null) { m_BoardPattern = BoardToNumberPattern(game); } }
public Agent( GammonInterface game ) { m_GUI = new AgentGUI( "Agent " + (++m_InstanceCounter) ); m_Rand = new Random(); m_BgGame = game; m_MoveRepresentationList = new MoveRepresentationList(); if ( m_MoveRepresentationGenerator == null ) m_MoveRepresentationGenerator = new MoveRepresentationGenerator( game ); LoadPlugins(); OutputMovesAndScore = true; }
protected int[] BoardToNumberPattern( GammonInterface game ) { int[] result = new int[26]; for ( int i = 0; i < game.BoardSquareCount; i++ ) { if ( game.SquareOwner( i ) == game.CurrentPlayer ) result[i] = game.SquareCheckerCount( i ); else if ( game.SquareOwner( i ) == game.CurrentOpponentPlayer ) result[i] = -( game.SquareCheckerCount( i ) ); else result[i] = 0; } return result; }
protected int[] BoardToNumberPattern(GammonInterface game) { int[] result = new int[26]; for (int i = 0; i < game.BoardSquareCount; i++) { if (game.SquareOwner(i) == game.CurrentPlayer) { result[i] = game.SquareCheckerCount(i); } else if (game.SquareOwner(i) == game.CurrentOpponentPlayer) { result[i] = -(game.SquareCheckerCount(i)); } else { result[i] = 0; } } return(result); }
public MoveRepresentation( GammonInterface game, BgMove move ) : base(game) { m_Score = 0.0; m_Move = move; BgMove m = m_Move.FirstMove; while ( m != null ) { if ( m.To != 26 && m_BoardPattern[m.To] == -1 ) { m_BoardPattern[m.To] = 0; m_BoardPattern[0]--; } m_BoardPattern[m.From]--; if ( m.To != 26 ) m_BoardPattern[m.To]++; m = m.NextMove; } }
public BgMoveGenerator( GammonInterface game ) { m_BgGame = game; }
public MainForm() { this.Width = 582; this.Height = 574; this.MaximizeBox = false; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.StartPosition = FormStartPosition.CenterScreen; this.Icon = new Icon( GetType(), "App.ico" ); this.Text = "Fuzzy-Gammon"; m_NotifyIcon = new NotifyIcon(); m_NotifyIcon.Text = this.Text; m_NotifyIcon.Icon = this.Icon; m_NotifyIcon.Visible = false; m_NotifyIcon.Click += new EventHandler( m_NotifyIcon_Click ); this.Resize += new EventHandler( MainForm_Resize ); m_SeedSelectorForm = new SeedSelector(); SetupMenu(); SetupGraphic(); SetupPanel(); m_GammonGame = new GammonInterface( m_NackgammonMenuItem.Checked, m_MaxFivePiecesOnPointMenuItem.Checked ); m_Agent1 = new Agent( m_GammonGame ); m_Agent2 = new Agent( m_GammonGame ); m_AutoPlayMode = false; m_DarkWins = new int[4]; for ( int i = 0; i < m_DarkWins.Length; i++ ) m_DarkWins[i] = 0; m_LightWins = new int[4]; for ( int i = 0; i < m_LightWins.Length; i++ ) m_LightWins[i] = 0; NewGame(); }
public BoardRepresentation( GammonInterface game ) { if ( game != null ) m_BoardPattern = BoardToNumberPattern( game ); }
public string Encode( GammonInterface game ) { string result = BitStringPatternToStringPattern( NumberPatternToBitStringPattern( BoardToNumberPattern( game ) ) ); result += game.GetDiceValue(0).ToString() + game.GetDiceValue(1).ToString(); return result; }
private MoveRepresentation( GammonInterface game ) : base(game) { }
public MoveRepresentationGenerator( GammonInterface game ) { m_BgGame = game; m_MoveList = new BgMoveList(); m_MoveGenerator = new BgMoveGenerator( game ); m_PatternEncoder = new PatternEncoder(); m_CurrentGeneratedMoves = new MoveRepresentationList(); }