/// <summary> /// Creates a view of a marble /// </summary> /// <param name="boardView">View of board</param> /// <param name="fromView">Square of marble</param> /// <param name="team">Team of marble</param> /// <param name="position">Position of square</param> public MarbleView(BoardView boardView, SquareView fromView, sbyte team, Vector2 position) { this.boardView = boardView; this.position = position; FromView = fromView; Team = team; }
/// <summary> /// Creates a view of a square /// </summary> /// <param name="view">View of the board</param> /// <param name="rect">Bounding Box</param> /// <param name="team">Marble team that the square is representing</param> public SquareView(BoardView view, Rectangle rect, sbyte team) { this.view = view; Rect = rect; Team = team; HasMarble = true; }
protected void LoadContent() { //Load fonts SmartFont[] fonts = new SmartFont[100]; fonts[16] = fontFactory.LoadFont("Consolas", 16f).Load(); //fonts[32] = fontFactory.LoadFont("Consolas", 32f).Load(); //fonts[72] = fontFactory.LoadFont("LemonMilk", 72f).Load(); TextureLib textures = new TextureLib(GraphicsDevice, contentManager); //Load textures textures.LoadTexture("pixel"); textures.LoadTexture("board"); textures.LoadTexture("boardBevel"); textures.LoadTexture("marbleTable"); textures.LoadTexture("title"); textures.LoadTexture("play"); textures.LoadTexture("singleplayer"); textures.LoadTexture("singleplayerBig"); textures.LoadTexture("multiplayer"); textures.LoadTexture("howtoplay"); textures.LoadTexture("options"); textures.LoadTexture("about"); textures.LoadTexture("goback"); textures.LoadTexture("gamesetup"); textures.LoadTexture("human"); textures.LoadTexture("computer"); textures.LoadTexture("indentBlue"); textures.LoadTexture("indentBrown"); textures.LoadTexture("indentGreen"); textures.LoadTexture("indentRed"); textures.LoadTexture("indentYellow"); textures.LoadTexture("blueMarble"); textures.LoadTexture("greenMarble"); textures.LoadTexture("redMarble"); textures.LoadTexture("yellowMarble"); content = new GameContent(textures, fonts); board = new Board(); boardView = new BoardView(board, Size); boardView.AnalysisView = this.AnalysisView; boardView.NotationView = this.NotationPane; boardView.LoadContent(Device, Content); Player[] players = new Player[4]; players[0] = new ComputerPlayer(0, Personality.Adaptive, ComputerPlayer.Difficulties[9], boardView); players[1] = new ComputerPlayer(1, Personality.Aggressive, ComputerPlayer.Difficulties[9], boardView); players[2] = new ComputerPlayer(2, Personality.Active, ComputerPlayer.Difficulties[9], boardView); players[3] = new ComputerPlayer(3, Personality.Passive, ComputerPlayer.Difficulties[9], boardView); boardView.SetPlayers(players); boardView.Playing = true; }
/// <summary> /// Creates a view of a square /// </summary> /// <param name="boardView">BoardView</param> /// <param name="square">Square</param> /// <param name="rect">Rectangle</param> public BoardSquareView(BoardView boardView, Square square, Rectangle rect) { this.boardView = boardView; Square = square; Color = Color.White; Rect = rect; }
public override void Load(GameContent content) { const int margin = 45; Rectangle boardRect = new Rectangle(margin, margin, engine.Window.ClientBounds.Width - (margin * 2) - 20, engine.Window.ClientBounds.Height - (margin * 2) - 20); AddDrawable((bgMarble = new Sprite(content.Textures["marbleTable"], engine.Window.ClientBounds))); AddDrawable((bg = new Sprite(content.Textures["board"], boardRect))); board = new Board(); boardView = new BoardView(board, boardRect); boardView.LoadContent(engine.GraphicsDevice, engine.Content); AddObject(boardView); AddRenderable(boardView); }
public GameState TargetScopeStartGame() { Gameplay gameplay = (Gameplay)engine.GetGameState("gameplay"); Player[] players = new Player[4]; BoardView view = gameplay.GetBoard(); for (int i = 0; i < players.Length; i++) { players[i] = GetPlayer(view, i); } gameplay.SetPlayers(players); view.Playing = true; return(gameplay); }
public Player GetPlayer(BoardView boardView, int playerNum) { switch (playerNum) { case 0: return((toggleButtonP1.SelectionIndex == 0) ? (Player) new HumanPlayer(0, boardView) : (Player) new ComputerPlayer(0, Personality.Active, ComputerPlayer.Difficulties[9], boardView)); case 1: return((toggleButtonP2.SelectionIndex == 0) ? (Player) new HumanPlayer(1, boardView) : (Player) new ComputerPlayer(1, Personality.Aggressive, ComputerPlayer.Difficulties[0], boardView)); case 2: return((toggleButtonP3.SelectionIndex == 0) ? (Player) new HumanPlayer(2, boardView) : (Player) new ComputerPlayer(2, Personality.Balanced, ComputerPlayer.Difficulties[0], boardView)); case 3: return((toggleButtonP4.SelectionIndex == 0) ? (Player) new HumanPlayer(3, boardView) : (Player) new ComputerPlayer(3, Personality.Adaptive, ComputerPlayer.Difficulties[0], boardView)); } return(null); }
static void TestThreading() { Board board = new Board(); board.Set("g5", Board.YELLOW); BoardView model = new BoardView(board, 700); ComputerPlayer plyr = new ComputerPlayer(Board.YELLOW, Personality.Passive, new Difficulty(10000, 0.0), model); plyr.StartThink(board, new DiceRoll(5, 6)); while (plyr.IsThinking) { Console.WriteLine("Thinking..."); Thread.Sleep(150); } //Dont need to dispose boardView, Load has not been called Console.WriteLine("Done, best move is: {0}", plyr.GetMove().GetNotation()); Console.ReadKey(); }
public ComputerPlayer(sbyte team, Personality personality, Difficulty difficulty, BoardView boardView) : base(team, false, boardView) { Difficulty = difficulty; Personality = personality; maxNAlgorithm = new MaxN(boardView.Board); paranoidAlgorithm = new Paranoid(boardView.Board); offensiveAlgorithm = new Offensive(boardView.Board); mixAlgorithm = new MPMix(boardView.Board, 0.5, 0.5); mctsAlgorithm = new MCTS(boardView.Board); }
private void marbleSoundsCheckBox_CheckBoxCheckChanged(object sender, EventArgs e) { BoardView view = mbControl.GetBoard(); }
private void rotateBoardBtn_Click(object sender, EventArgs e) { BoardView view = mbControl.GetBoard(); view.Rotate(); }