示例#1
0
        public MainPage()
        {
            Game game;
            game = new Game();
            TTskProvider tprov = new TTskProvider(game);
            tprov.tskBad(tprov.encodeTask('f'));
            tprov.tskBad(tprov.encodeTask('g'));
            tprov.tskBad(tprov.encodeTask('g'));
            tprov.tskBad(tprov.encodeTask('g'));
            tprov.tskBad(tprov.encodeTask('h'));

            tprov.tskGood(tprov.encodeTask('h'),true);

            TRandom rand = new TRandom("0123456789", null,0);
            Dictionary<Char, int> dic = new Dictionary<Char, int>();
            rand.count = 6;
            rand.only.Add(2);
            rand.only.Add(1);
            rand.only.Add(5);

            rand.freq[2] = 1;
            rand.freq[4] = 2;
            Char c;
            String res = "";
            string res1 = "";
            for (int i = 0; i < rand.count; i++) dic.Add(rand.charAt(i), 0);
            for (int i = 0; i < 800; i++) { res += (c = rand.getVal()); dic[c]++; }
            for (int i = 0; i < dic.Count; i++)res1 += " " + dic.ElementAt(i).Key + '='+dic.ElementAt(i).Value.ToString() + ' ';
            InitializeComponent();
        }
示例#2
0
        public PacmanCharacter(Board Gameboard, Player GamePlayer, Game CurrentGame)
        {
            Speed = 1;
            Direction = 0;
            State = 0;
            Board = Gameboard;
            Timer = 0;

            this.Game = CurrentGame;
            Player = GamePlayer;

            //starting position
            this.Position.X = 1;
            this.Position.Y = 1;
        }
示例#3
0
        public GhostCharacter(Board Gameboard, Player GamePlayer, Game CurrentGame, PacmanCharacter Pacman)
        {
            Speed = 1;
            Direction = 0;
            State = 0;
            Board = Gameboard;

            this.Game = CurrentGame;
            Player = GamePlayer;
            PlayerPacman = Pacman;

            //starting position
            this.Position.X = 13;
            this.Position.Y = 14;
        }
示例#4
0
 public GhostPresenter(Game game, int i)
 {
     _game = game;
     _index = i;
     _current = null;
     _game.NotifyOn<Game>("Ghosts", delegate
     {
         if (_current != null)
             _current.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(_current_PropertyChanged);
              if (_index < _game.Ghosts.Count)
              {
                  _current = _game.Ghosts[_index];
              }
              else _current = null;
         if (_current != null)
             _current.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_current_PropertyChanged);
         NotifyPropertyChanged("Ghost");
     });
 }
示例#5
0
        public void TestPlayer()
        {
            string UserName;
            UserName = "******";
            Game TestGame = new Game (UserName);
            TestGame.Board.ReadMap ();

            TestGame.Board.DrawBoard ();
            TestGame.DisplayInstructionScore ();

            TestGame.RandomGhost.Position.X = 1;
            TestGame.RandomGhost.Position.Y = 1;

            Assert.IsTrue (TestGame.Player.Lives == 3);

            TestGame.Pacman.CheckFunction ();
            TestGame.RandomGhost.CheckFunction ();
            Assert.IsTrue (TestGame.Player.Lives == 2);
        }
示例#6
0
        public void TestPacman()
        {
            string UserName;
            UserName = "******";
            Game TestGame = new Game (UserName);
            TestGame.Board.ReadMap ();

            TestGame.Board.DrawBoard ();
            TestGame.DisplayInstructionScore ();

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
            Assert.IsTrue (TestGame.Pacman.State == 0);
            Assert.IsTrue (TestGame.Player.Score == 0);

            TestGame.Pacman.MovementFunction ('S');

            Assert.IsTrue (TestGame.Pacman.Position.X == 2);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
            Assert.IsTrue (TestGame.Player.Score == 3);
            Assert.IsTrue (TestGame.Pacman.State == 1);

            TestGame.Pacman.MovementFunction ('W');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);

            TestGame.Pacman.MovementFunction ('D');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 2);
            Assert.IsTrue (TestGame.Player.Score == 4);

            TestGame.Pacman.MovementFunction ('A');

            Assert.IsTrue (TestGame.Pacman.Position.X == 1);
            Assert.IsTrue (TestGame.Pacman.Position.Y == 1);
        }
示例#7
0
        public static void Main(string[] args)
        {
            Console.Clear ();
            Console.WriteLine ("Enter User Name: ");
            string UserName;
            UserName = Console.ReadLine();
            Game MainGame = new Game (UserName);
            MainGame.Board.ReadMap ();

            MainGame.Board.DrawBoard ();
            MainGame.DisplayInstructionScore ();

            do
            {
                MainGame.Pacman.MovementFunction ();
                MainGame.RandomGhost.MovementFunction();
                MainGame.TrackingGhost.TrackMovementFunction();
                MainGame.Board.DrawBoard ();
                MainGame.DisplayInstructionScore ();
            }while(MainGame.GameOverState == false);

            Console.WriteLine ("Game Over");
        }
示例#8
0
 public BonusPresenter(Game g)
 {
     _currentGame = g;
     _currentGame.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_currentGame_PropertyChanged);
 }
示例#9
0
 public PacmanPresenter(Game game)
 {
     _game = game;
     _game.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_game_PropertyChanged);
 }