Exemplo n.º 1
0
        public static Platter SetRegisterC(this Platter platter, uint value)
        {
            var shiftedValue = value;
            var maskedValue  = platter.Value & 0xFFFFFFF8;

            return(new Platter(maskedValue + shiftedValue));
        }
Exemplo n.º 2
0
        public void Platter_Initialize_Four_Bytes()
        {
            Platter p           = new Platter(new byte[] { 255, 255, 255, 255 });
            uint    magnificent = 4278190080;
            uint    lovely      = 16711680;
            uint    mediocre    = 65280;
            uint    shoddy      = 255;

            Assert.AreEqual(magnificent + lovely + mediocre + shoddy, p.Value);

            p = new Platter(new byte[] { 255, 0, 0, 0 });
            Assert.AreEqual(magnificent, p.Value);

            p = new Platter(new byte[] { 0, 255, 0, 0 });
            Assert.AreEqual(lovely, p.Value);

            p = new Platter(new byte[] { 0, 0, 255, 0 });
            Assert.AreEqual(mediocre, p.Value);

            p = new Platter(new byte[] { 0, 0, 0, 255 });
            Assert.AreEqual(shoddy, p.Value);

            p = new Platter(new byte[] { 0, 0, 0, 0 });
            Assert.AreEqual((uint)0, p.Value);
        }
Exemplo n.º 3
0
        public static Platter SetOperation(this Platter platter, uint mu32operator)
        {
            var shiftedOperator = mu32operator << 28;
            var maskedValue     = platter.Value & 0x0FFFFFFF;

            return(new Platter(maskedValue + shiftedOperator));
        }
Exemplo n.º 4
0
        public override string Action(Player _player, Platter _platter)
        {
            //TODO random chance action

            _player.Balance += 100;
            return("C'est un carte chance. Vous recevez 100.");
        }
Exemplo n.º 5
0
    public void endPlatterDrag(Platter platter, Vector3 position)
    {
        //translate from world space into game space
        int x = Mathf.FloorToInt(position.x / horizontalSpace) + 1;
        int y = Mathf.FloorToInt(position.y / verticalSpace) + 1;

        servePlatter(platter, x, y);
    }
Exemplo n.º 6
0
        public void Platter_RegisterC()
        {
            Platter p = new Platter(new byte[] { 0, 0, 0, 255 });

            Assert.AreEqual((uint)7, p.RegisterC);

            p = new Platter(new byte[] { 0, 0, 0, 4 });
            Assert.AreEqual((uint)4, p.RegisterC);
        }
Exemplo n.º 7
0
        public void Platter_RegisterB()
        {
            Platter p = new Platter(new byte[] { 0, 0, 0, 255 });

            Assert.AreEqual((uint)7, p.RegisterB);
            p = new Platter(new byte[] { 0, 0, 0, 40 });
            Assert.AreEqual((uint)5, p.RegisterB);

            var newP = p.SetRegisterB(6);

            Assert.AreEqual((uint)6, newP.RegisterB);
        }
Exemplo n.º 8
0
        public void Platter_RegisterA()
        {
            Platter p = new Platter(new byte[] { 0, 0, 255, 255 });

            Assert.AreEqual((uint)7, p.RegisterA);
            p = new Platter(new byte[] { 0, 0, 1, 0 });
            Assert.AreEqual((uint)4, p.RegisterA);

            var newP = p.SetRegisterA(5);

            Assert.AreEqual((uint)5, newP.RegisterA);
        }
Exemplo n.º 9
0
        public void Platter_OperatorNumber()
        {
            Platter p = new Platter(new byte[] { 255, 255, 255, 255 });

            Assert.AreEqual((uint)15, p.OperatorNumber);

            p = new Platter(new byte[] { 0xF0, 255, 255, 255 });
            Assert.AreEqual((uint)15, p.OperatorNumber);

            p = new Platter(new byte[] { 0x90, 255, 255, 255 });
            Assert.AreEqual((uint)0x9, p.OperatorNumber);
        }
Exemplo n.º 10
0
        protected override void New()
        {
            var cancel = Close();

            if (cancel)
            {
                return;
            }
            IsCreated = true;
            Platter   = new Platter();
            Platter.FillDefaultCase();
        }
Exemplo n.º 11
0
    public Platter newPlatter()
    {
        Platter platter = Platter.CreateInstance <Platter>();

        platter.Foods[0] = getRandomFood();
        for (int i = 1; i < 4; i++)
        {
            if (Random.Range(0f, 1f) > 0.7f)
            {
                platter.Foods[i] = getRandomFood();
            }
        }
        return(platter);
    }
Exemplo n.º 12
0
    public void setPlatter(Platter platter)
    {
        this.platter = platter;

        for (int i = 0; i < 4; i++)
        {
            FoodType food = platter.Foods[i];
            if (food != null)
            {
                GameObject foodObj = Instantiate(food.prefab, transform);
                foodObj.transform.localPosition = new Vector3(xPos[i], yPos[i], -1.5f);
                foodObj.transform.localScale    = new Vector3(0.3f, 0.3f);
            }
        }
    }
Exemplo n.º 13
0
        private static Um32 BuildUm32()
        {
            var platters = new Platter[]
            {
                new Platter(10),
                new Platter(20),
                new Platter(30),
                new Platter(40),
                new Platter(50),
                new Platter(60),
                new Platter(70),
            };
            var um32 = new Um32(platters);

            return(um32);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public PlatterViewModel()
        {
            // Init Platter model
            Model = new Platter();

            // Init dices
            DieOne          = new Die(1, 6);
            DieSecond       = new Die(1, 6);
            RollDiceCommand = new RelayCommand(_param => RollDice(), _param => IsStarted);

            // Init game vars
            turnCount       = 0;
            doubleDiceCount = 0;
            doPlayAgain     = false;

            FillPosToWPF();
        }
Exemplo n.º 15
0
 // x and y are the coordinates, 1 indexed
 // (since <1,1> will hit <0,0> <0,1> <1,0> and <1,1>)
 private void servePlatter(Platter platter, int x, int y)
 {
     for (int i = 0; i < 4; i++)
     {
         int a = x + xOffset[i];
         int b = y + yOffset[i];
         if (a < 0 || b < 0 || a >= gridWidth || b >= gridHeight)
         {
             continue;
         }
         Table table = tableGrid[a][b];
         if (table)
         {
             table.feedDish(platter.Foods[i]);
         }
     }
 }
Exemplo n.º 16
0
        public override string Action(Player _player, Platter _platter)
        {
            //TODO random in action

            //Remove nbPlayer*50
            _player.Balance -= (_platter.Players.Count - 1) * 50;

            //Add 50 to each other players
            foreach (Player player in _platter.Players)
            {
                if (player != _player)
                {
                    player.Balance += 50;
                }
            }

            return("Vous récupérez un carte communautaire. Payez 50 à chaque joueur.");
        }
Exemplo n.º 17
0
        public void Platter_Operation()
        {
            var p = new Platter(new byte[] { 0xF0, 255, 255, 255 });

            Assert.AreEqual((uint)15, p.OperatorNumber);

            var newP = p.SetRegisterA(3).SetRegisterB(6).SetRegisterC(2);

            Assert.AreEqual((uint)3, newP.RegisterA);
            Assert.AreEqual((uint)6, newP.RegisterB);
            Assert.AreEqual((uint)2, newP.RegisterC);
            Assert.AreEqual((uint)15, newP.OperatorNumber);

            newP = p.SetRegisterA(3).SetRegisterB(6).SetRegisterC(2).SetOperation(11);
            Assert.AreEqual((uint)3, newP.RegisterA);
            Assert.AreEqual((uint)6, newP.RegisterB);
            Assert.AreEqual((uint)2, newP.RegisterC);
            Assert.AreEqual((uint)11, newP.OperatorNumber);
        }
Exemplo n.º 18
0
        public void Um32_ConditionalMove_False()
        {
            Um32 um32   = BuildUm32();
            uint aIndex = 0;
            uint bIndex = 1;
            uint cIndex = 7;

            um32.AssignRegister(aIndex, 0);  // A
            um32.AssignRegister(bIndex, 23); // B
            um32.AssignRegister(cIndex, 0);  // C
            var platter = new Platter(0)
                          .SetOperation(OperatorConstants.ConditionalMove)
                          .SetRegisterA(aIndex)
                          .SetRegisterB(bIndex)
                          .SetRegisterC(cIndex);

            um32.DischargeOperator(platter);

            Assert.AreEqual((uint)0, um32.ReadRegister(aIndex));
        }
Exemplo n.º 19
0
        public void Um32_Nand()
        {
            Um32 um32   = BuildUm32();
            uint aIndex = 0;
            uint bIndex = 1;
            uint cIndex = 7;

            um32.AssignRegister(aIndex, 0); // A
            um32.AssignRegister(bIndex, 6); // B
            um32.AssignRegister(cIndex, 5); // C
            var platter = new Platter(0)
                          .SetOperation(OperatorConstants.NotAnd)
                          .SetRegisterA(aIndex)
                          .SetRegisterB(bIndex)
                          .SetRegisterC(cIndex);

            um32.DischargeOperator(platter);

            Assert.AreEqual((uint)7, um32.ReadRegister(aIndex));
        }
Exemplo n.º 20
0
        private void Generate(EnumGenerateGameType _gameType)
        {
            var cancel = Close();

            if (cancel)
            {
                return;
            }
            switch (_gameType)
            {
            case EnumGenerateGameType.Classic:
                //TODO
                break;

            case EnumGenerateGameType.Random:
                IsCreated = true;
                Platter   = new Platter();
                Platter.FillRandomCase();
                break;
            }
        }
Exemplo n.º 21
0
 public override string Action(Player _player, Platter _platter)
 {
     _player.Balance -= 200;
     return("Vous payer 200 pour vos taxes");
 }
Exemplo n.º 22
0
 void Awake()
 {
     ints_platt = this;
     Plater     = false;
 }
Exemplo n.º 23
0
 public void Platter_Initialize_3_Bytes()
 {
     Platter p = new Platter(new byte[] { 255, 255, 255 });
 }
Exemplo n.º 24
0
 public override string Action(Player _player, Platter _platter)
 {
     return("Il ne se passe rien.");
 }
Exemplo n.º 25
0
 public override string Action(Player _player, Platter _platter)
 {
     return("Voulez vous achetez la station " + Text + " ?");
 }
Exemplo n.º 26
0
 public override string Action(Player _player, Platter _platter)
 {
     return("Vous êtes sur un parking gratuit.");
 }
Exemplo n.º 27
0
 public override string Action(Player _player, Platter _platter)
 {
     return("Vous allez en prison");
 }
Exemplo n.º 28
0
 public override string Action(Player _player, Platter _platter)
 {
     return("Vous êtes en visite en prison");
 }
Exemplo n.º 29
0
        public void Platter_Initialize()
        {
            Platter p = new Platter(32376);

            Assert.AreEqual((uint)32376, p.Value);
        }