示例#1
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
 public void shootsArrows(Boolean shootsArrow) //if player shoots arrow at Wumpus
 {
     if (state == WumpusState.Asleep && shootsArrow == true)
     {
         state = WumpusState.Awake;
         int runNumber = new Random().Next(1, 4); //makes it run up to 3 rooms
         turnsSinceWumpus = 0;
         if (runNumber == 1)
         {
             //runs 1 room away-calls map to do?
             int number = new Random().Next(1, 31); // number of rooms
             //if(boolean cave something == true){
             //make it run 1 room away
             //}
             state = WumpusState.Moving;
         }
         else if (runNumber == 2)
         {
             //runs 2 rooms away
             state = WumpusState.Moving;
         }
         else if (runNumber == 3)
         {
             //runs 3 rooms away
             state = WumpusState.Moving;
         }
     }
     else
     {
         turnsSinceWumpus++;
     }
 }
示例#2
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
 public void playerEnters(int playerPosition, Boolean pit, Boolean bats) //situations awakening Wumpus; when player enters the same room
 {
     state = WumpusState.Asleep;
     if (playerPosition == position && pit == false && bats == false)
     {
         state = WumpusState.Awake;
         //go to trivia
         turnsSinceWumpus = 0;
     }
     else if (playerPosition == position && pit == true && bats == false)
     {
         state = WumpusState.Awake;
         //position moves - calls cave
         turnsSinceWumpus = 0;
     }
     else if (playerPosition == position && pit == false && bats == true)
     {
         state = WumpusState.Awake;
         //position moves - calls cave
         turnsSinceWumpus = 0;
     }
     else
     {
         turnsSinceWumpus++;
     }
 }
示例#3
0
        public WumpusMove howWumpusWillMove()
        {
            subdivisionTurn++;
            if (random.Next(100) < 5)
            {
                State = WumpusState.awake;
                subdivisionTurn = 0;
                return WumpusMove.Teleport;
            }
            else if (subdivisionTurn >= 5 && subdivisionTurn < 10)
            {
                State = WumpusState.awake;
                if (random.Next(50) < 10)
                {
                    subdivisionTurn = 0;
                    int x = random.Next(3);
                    if (x == 0){
                        return WumpusMove.DontMove;
                    }
                    if (x == 1) {
                        return WumpusMove.MoveOne;
                    }
                    if (x == 2) {
                        return WumpusMove.MoveTwo;
                    }

                }

                State = WumpusState.asleep;
            }

            else if (subdivisionTurn == 10)
            {
                State = WumpusState.awake;
                if (random.Next(50) < 10)
                {
                    subdivisionTurn = 0;
                    int x = random.Next(3);
                    if (x == 0)
                    {
                        return WumpusMove.DontMove;
                    }
                    if (x == 1)
                    {
                        return WumpusMove.MoveOne;
                    }
                    if (x == 2)
                    {
                        return WumpusMove.MoveTwo;
                    }

                }

                State = WumpusState.asleep;
            }

            //Trivia will be taken care of GC. Remind GameControl
            return WumpusMove.DontMove;
        }
示例#4
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
 public void fallsAsleep()
 {
     if (turnsSinceWumpus > 2)
     {
         state = WumpusState.Asleep;
         //add
     }
 }
示例#5
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
 public Wumpus()
 {
     //constructor
     state = WumpusState.Awake;
     //state = "awake";
     //randomly generate position
     position = new Random().Next(1, 31);
 }
示例#6
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
        public void wumpusDefeat(Boolean defeat)
        {
            if (defeat == true)
            {
                Node <Room> current = new Node <Room>(new Room(position));
                //Pull room from the list m_roomList in Cave object with the index of 'position'



                //call cave to make it run 3 rooms away
                Random r      = new Random();
                int    number = r.Next(3) + 1;

                //moveWumpus(number, c1);
                state = WumpusState.Moving;
            }
        }
示例#7
0
文件: Map.cs 项目: tenghisu/Wumpus
        public int wumpusLocation()
        {
            Wumpus      wumpus         = new Wumpus();
            int         wumpusPosition = wumpus.getWumpusPosition();
            WumpusState state          = wumpus.getWumpusState();
            int         movement       = 0;

            if (state == "asleep")
            {
                movement = 0;
            }
            else
            {
                movement = 1;
            }
            return(roomNumberWumpus + movement);
            // given the wumpus state I can make the wumpus move to a whole new room number
        }
示例#8
0
文件: Wumpus.cs 项目: tenghisu/Wumpus
 public Wumpus(WumpusState state, int position)
 {
     this.state    = state;
     this.position = position;
 }