Beispiel #1
0
 // Use this for specific initialization
 public void init(Body bodyToTrack, BodySourceManager bodySourceManager, GameObject trackedBodyObj, hand handType)
 {
     trackedBody       = bodyToTrack;
     bodyManager       = bodySourceManager;
     thisHand          = handType;
     trackedBodyObject = trackedBodyObj;
 }
Beispiel #2
0
        private hand addHandToDB(HandHistory handHistory, table handTable)
        {
            hand dbHand = db.hands.Find(handHistory.HandId);

            if (dbHand != null)
            {
                return(dbHand);
            }
            IEnumerator <Card> cardList = handHistory.CommunityCards.GetEnumerator();

            dbHand = new Models.hand
            {
                HandID         = handHistory.HandId,
                TableID        = handTable.TableID,
                NumPlayers     = handHistory.NumPlayersActive,
                StartTime      = handHistory.DateOfHandUtc,
                ButtonPosition = handHistory.DealerButtonPosition,
                PotSize        = handHistory.TotalPot,
                FlopCard1      = (cardList.MoveNext()) ? cardList.Current.ToString() : null,
                FlopCard2      = (cardList.MoveNext()) ? cardList.Current.ToString() : null,
                FlopCard3      = (cardList.MoveNext()) ? cardList.Current.ToString() : null,
                TurnCard       = (cardList.MoveNext()) ? cardList.Current.ToString() : null,
                RiverCard      = (cardList.MoveNext()) ? cardList.Current.ToString() : null,
                table          = handTable,
            };
            db.hands.Add(dbHand);
            return(dbHand);
        }
Beispiel #3
0
    // Update is called once per frame
    void altUpdate()
    {
        hand _hand = HandObj.GetComponent <hand>();

        Debug.Log(_hand.yaw);

        /*
         * KeyCode kcNegative = KeyCode.A;
         * KeyCode kcPositive = KeyCode.D;
         * Vector3 v3Rotation = new Vector3(1.0f, 0.0f, 0.0f);
         *
         * if (Input.GetKey(kcPositive))
         *  transform.Rotate(v3Rotation);
         * if (Input.GetKey(kcNegative))
         *  transform.Rotate(-v3Rotation);
         */


        // float roll = Input.GetAxis("Horizontal");
        // float pitch = Input.GetAxis("Vertical");
        float deltaRoll = _hand.getDeltaRoll();
        //(Input.GetKey(KeyCode.D) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.A) ? 1f : 0f);

        float deltaPitch = _hand.getDeltaPitch();
        //(Input.GetKey(KeyCode.W) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.S) ? 1f : 0f);

        float deltaYaw = _hand.getDeltaYaw();
        //(Input.GetKey(KeyCode.RightArrow) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.LeftArrow) ? 1f : 0f);

        Vector3 currentRotation = transform.localRotation.eulerAngles;

        // Pitch: rotate around x-axis
        // TODO this sucks if (deltaPitch > 0 && currentRotation.x > 270
        transform.Rotate(Vector3.right, -deltaPitch * moveSpeed * Time.deltaTime);

        // Roll: rotate around z-axis
        transform.Rotate(Vector3.forward, deltaRoll * moveSpeed * Time.deltaTime);

        // Yaw: rotate around y-axis
        transform.Rotate(Vector3.up, deltaYaw * moveSpeed * Time.deltaTime);

        // Debug.Log(currentRotation);

        /*
         * float minRotation = 270;
         * float maxRotation = 90;
         *
         * currentRotation.x = Utils.ClampAngle(currentRotation.x, minRotation, maxRotation);
         * currentRotation.z = Utils.ClampAngle(currentRotation.z, minRotation, maxRotation);
         * transform.localRotation = Quaternion.Euler(currentRotation);
         */

        /*
         * Vector3 movement = new Vector3(moveX, 0f, moveZ);
         * GetComponent<Rigidbody>().velocity += movement * moveSpeed * Time.deltaTime;
         */
    }
Beispiel #4
0
        public void AddPlayer(String name)
        {
            hand newHand = new hand();

            newHand.Name = name;
            players.Add(newHand);     //null reference exception here! you should initialize players
        }
Beispiel #5
0
        private List <string> ParseHands(SiteName site, string handText, ref int parsedHands, ref int thrownOutHands)
        {
            List <string> messages = new List <string>();
            // Each poker site has its own parser so we use a factory to get the right parser.
            IHandHistoryParserFactory handHistoryParserFactory = new HandHistoryParserFactoryImpl();

            // Get the correct parser from the factory.
            IHandHistoryParser handHistoryParser = handHistoryParserFactory.GetFullHandHistoryParser(site);

            try
            {
                List <string> hands = new List <string>();
                hands = handHistoryParser.SplitUpMultipleHands(handText).ToList();
                db.Configuration.AutoDetectChangesEnabled = false;
                foreach (string hand in hands)
                {
                    try
                    {
                        // The true causes hand-parse errors to get thrown. If this is false, hand-errors will
                        // be silent and null will be returned.
                        HandHistory handHistory = handHistoryParser.ParseFullHandHistory(hand, true);

                        //handhistory can now be broken down to be put into the database

                        // Add to player table
                        Dictionary <string, player> playerDict = addPlayersToDB(handHistory);

                        // Add to table table
                        table dbTable = addTableToDB(handHistory);

                        db.SaveChanges();

                        //Add to hand table
                        hand dbHand = addHandToDB(handHistory, dbTable);

                        // Add to hand_action table
                        addHandActionToDB(handHistory, dbHand, playerDict);

                        // Add to plays table
                        addPlaysToDB(handHistory, playerDict);

                        db.SaveChanges();

                        parsedHands++;
                    }
                    catch (Exception ex)
                    {
                        messages.Add("Parsing Error: " + ex.Message);
                        thrownOutHands++;
                    }
                }
            }
            catch (Exception ex) // Catch hand-parsing exceptions
            {
                messages.Add("Parsing Error: " + ex.Message);
            }
            db.Configuration.AutoDetectChangesEnabled = true;
            return(messages);
        }
        public ActionResult DeleteConfirmed(long id)
        {
            hand hand = db.hands.Find(id);

            db.hands.Remove(hand);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #7
0
 public void Shoot(hand hand)
 {
     this.currentHand = hand;
     if (status == BallState.inHand)
     {
         status        = BallState.shooted;
         rb.useGravity = true;
         rb.AddForce(new Vector3(1 * force, 0, 0));
     }
 }
 public ActionResult Edit([Bind(Include = "HandID,TableID,NumPlayers,StartTime,ButtonPosition,PotSize,FlopCard1,FlopCard2,FlopCard3,TurnCard,RiverCard")] hand hand)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hand).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TableID = new SelectList(db.tables, "TableID", "Stakes", hand.TableID);
     return(View(hand));
 }
Beispiel #9
0
    void Update()
    {
        hand _hand = HandObj.GetComponent <hand>();
        // Debug.Log(_hand.yaw);

        /*
         * KeyCode kcNegative = KeyCode.A;
         * KeyCode kcPositive = KeyCode.D;
         * Vector3 v3Rotation = new Vector3(1.0f, 0.0f, 0.0f);
         *
         * if (Input.GetKey(kcPositive))
         *  transform.Rotate(v3Rotation);
         * if (Input.GetKey(kcNegative))
         *  transform.Rotate(-v3Rotation);
         */


        // float roll = Input.GetAxis("Horizontal");
        // float pitch = Input.GetAxis("Vertical");
        float deltaRoll = _hand.getDeltaRoll();
        //(Input.GetKey(KeyCode.D) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.A) ? 1f : 0f);

        float deltaPitch = _hand.getDeltaPitch();
        //(Input.GetKey(KeyCode.W) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.S) ? 1f : 0f);

        float deltaYaw = _hand.getDeltaYaw();
        //(Input.GetKey(KeyCode.RightArrow) ? 1f : 0f) -
        //(Input.GetKey(KeyCode.LeftArrow) ? 1f : 0f);

        Vector3 currentRotation = transform.localRotation.eulerAngles;

        // Pitch: rotate around x-axis
        // TODO this sucks if (deltaPitch > 0 && currentRotation.x > 270
        //      transform.Rotate(Vector3.right, -1/(Mathf.Abs(_hand.pitch - _hand.nuetPitch)) * moveSpeed * Time.deltaTime);

        //      // Roll: rotate around z-axis
        //transform.Rotate(Vector3.forward, -1/(Mathf.Abs(_hand.roll - _hand.nuetRoll)) * moveSpeed * Time.deltaTime);

        //// Yaw: rotate around y-axis
        //transform.Rotate(Vector3.up, deltaYaw * moveSpeed * Time.deltaTime);

        //transform.eulerAngles.Set(_hand.getDeltaPitch(),_hand.getDeltaYaw(), _hand.getDeltaRoll());
        //float xRot = (Mathf.Abs(_hand.getDeltaPitch() * 180.0f / Mathf.PI) > angleThreshold) ? (ang );
        //float yRot = _hand.getDeltaYaw() * 180.0f / Mathf.PI;
        //float zRot = _hand.getDeltaRoll() * 180.0f / Mathf.PI


        transform.localRotation = Quaternion.Euler(_hand.getDeltaPitch(), _hand.getDeltaYaw(), _hand.getDeltaRoll());
    }
        // GET: hands/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hand hand = db.hands.Find(id);

            if (hand == null)
            {
                return(HttpNotFound());
            }
            return(View(hand));
        }
        // GET: hands/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hand hand = db.hands.Find(id);

            if (hand == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TableID = new SelectList(db.tables, "TableID", "Stakes", hand.TableID);
            return(View(hand));
        }
Beispiel #12
0
        private void addHandActionToDB(HandHistory handHistory, hand dbHand, Dictionary <string, player> playerDict)
        {
            int    aggro        = 0;
            int    actionNumber = 0;
            Street curStreet    = Street.Preflop;

            foreach (HandAction item in handHistory.HandActions)
            {
                if (db.hand_action.Find(handHistory.HandId, actionNumber) != null)
                {
                    continue;
                }
                if (curStreet != item.Street)
                {
                    curStreet = item.Street;
                    aggro     = 0;
                }
                if (item.IsAggressiveAction)
                {
                    aggro++;
                }

                hand_action newHandAction = new Models.hand_action
                {
                    HandID     = handHistory.HandId,
                    ActionID   = actionNumber,
                    PlayerID   = playerDict[item.PlayerName].PlayerID,
                    ActionName = item.HandActionType.ToString(),
                    Street     = item.Street.ToString(),
                    Amount     = item.Amount,
                    IsPFR      = item.IsPreFlopRaise,
                    IsVPIP     = (item.Street == Street.Preflop) ? (item.IsAggressiveAction || item.HandActionType == HandActionType.CALL) : false,
                    Is3Bet     = (item.IsAggressiveAction && aggro == 3),
                    Is4Bet     = (item.IsAggressiveAction && aggro == 4),
                    hand       = dbHand,
                    player     = playerDict[item.PlayerName],
                };
                db.hand_action.Add(newHandAction);
                actionNumber++;
            }
        }
        // GET: hands/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            hand hand = db.hands.Find(id);

            if (hand == null)
            {
                return(HttpNotFound());
            }
            List <hand_action> actionList  = db.hand_action.Where(s => s.HandID == id).ToList();
            HandDetails        handDetails = new Models.HandDetails
            {
                Hand       = hand,
                ActionList = actionList
            };

            return(View(handDetails));
        }
    public Transform OnRelease(hand _playerHand)
    {
        transform.localScale = originSize;
        transform.rotation   = Quaternion.identity;
        if (transform.position.z < 0.0f)
        {
            // delete from hand
            _playerHand.GetOutOfList(gameObject.transform);
            // attach to single test position
            transform.position = singleTest.position;
            _mySpot            = SpotType.SingleTest;

            return(transform);
        }
        else
        {
            _playerHand.GetOutOfList(gameObject.transform);
            Debug.Log("Goes to flow test.");
            switch (_myType)
            {
            case ModuleType.Tire:
                transform.position = flowTest[0].position;
                break;

            case ModuleType.Door:
                transform.position = flowTest[1].position;
                break;

            case ModuleType.Body:
                transform.position = flowTest[2].position;
                break;

            default:
                Debug.Log("Weird, shoundn't be default");
                break;
            }
            _mySpot = SpotType.FlowTest;
            return(transform);
        }
    }
 void pick(hand h)
 {
     t = rg.gen_pos();
     ij.Invoke(t.L, t.R);
 }
Beispiel #16
0
 // Use this for initialization
 void Start()
 {
     ahand = GetComponentInChildren <hand>();
     rb    = GetComponent <Rigidbody>();
 }
Beispiel #17
0
 public trackedControllerEvent(hand _hand, eventType _type)
 {
     time = Time.time;
     hand = _hand;
     type = _type;
 }
Beispiel #18
0
 // Use this for specific initialization
 public void init(Body bodyToTrack, BodySourceManager bodySourceManager, hand handType)
 {
     trackedBody = bodyToTrack;
     bodyManager = bodySourceManager;
     thisHand    = handType;
 }
Beispiel #19
0
        public void evaluateHands()
        {
            //create player's and computer's evaluation objects by passing sortedhand for each player to constructor
            EvaluateHands firstHandEvaluator  = new EvaluateHands(SortedHand[0]);
            EvaluateHands secondhandEvaluator = new EvaluateHands(SortedHand[1]);
            EvaluateHands thirdHandEvaluator  = new EvaluateHands(SortedHand[2]);
            EvaluateHands fourthHandEvaluator = new EvaluateHands(SortedHand[3]);

            //get evaluated hand for all players

            hand firstHand  = firstHandEvaluator.evaluateHand();
            hand secondHand = secondhandEvaluator.evaluateHand();
            hand thirdHand  = thirdHandEvaluator.evaluateHand();
            hand fourthHand = fourthHandEvaluator.evaluateHand();



            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n\n\nResult: ");
            Console.ResetColor();


            //display each hands
            Console.WriteLine("\nfirst Hand: " + firstHand);
            Console.WriteLine("\nsecond Hand: " + secondHand);
            Console.WriteLine("\nthird Hand: " + thirdHand);
            Console.WriteLine("\nfourth Hand: " + fourthHand);

            Console.ForegroundColor = ConsoleColor.Green;
            //evaluate who has higher hands and higher hand wins
            if (firstHand > secondHand && firstHand > thirdHand && firstHand > fourthHand)
            {
                Console.WriteLine("First Hand wins!");
            }
            else if (secondHand > firstHand && secondHand > thirdHand && secondHand > fourthHand)
            {
                Console.WriteLine("Second Hand wins!");
            }
            else if (thirdHand > secondHand && thirdHand > firstHand && thirdHand > fourthHand)
            {
                Console.WriteLine("Third Hand wins!");
            }
            else if (fourthHand > secondHand && fourthHand > firstHand && fourthHand > thirdHand)
            {
                Console.WriteLine("Fourth Hand wins!");
            }
            else // if the hands are same evaluate values
            {
                //highest value of poker hand if not check for highest card and highest card wins
                if (firstHandEvaluator.handValues.total > secondhandEvaluator.handValues.total &&
                    firstHandEvaluator.handValues.total > thirdHandEvaluator.handValues.total &&
                    firstHandEvaluator.handValues.total > fourthHandEvaluator.handValues.total)
                {
                    Console.WriteLine("First Hand Wins");
                }
                else if (secondhandEvaluator.handValues.total > firstHandEvaluator.handValues.total &&
                         secondhandEvaluator.handValues.total > thirdHandEvaluator.handValues.total &&
                         secondhandEvaluator.handValues.total > fourthHandEvaluator.handValues.total)
                {
                    Console.WriteLine("Second Hand Wins");
                }
                else if (thirdHandEvaluator.handValues.total > secondhandEvaluator.handValues.total &&
                         thirdHandEvaluator.handValues.total > firstHandEvaluator.handValues.total &&
                         thirdHandEvaluator.handValues.total > fourthHandEvaluator.handValues.total)
                {
                    Console.WriteLine("Third Hand Wins");
                }
                else if (fourthHandEvaluator.handValues.total > secondhandEvaluator.handValues.total &&
                         fourthHandEvaluator.handValues.total > thirdHandEvaluator.handValues.total &&
                         fourthHandEvaluator.handValues.total > firstHandEvaluator.handValues.total)
                {
                    Console.WriteLine("Fourth Hand Wins");
                }
                else if (firstHandEvaluator.handValues.highCard > secondhandEvaluator.handValues.highCard &&
                         firstHandEvaluator.handValues.highCard > thirdHandEvaluator.handValues.highCard &&
                         firstHandEvaluator.handValues.highCard > fourthHandEvaluator.handValues.highCard)
                {
                    Console.WriteLine("First Hand Wins");
                }
                else if (secondhandEvaluator.handValues.highCard > firstHandEvaluator.handValues.highCard &&
                         secondhandEvaluator.handValues.highCard > thirdHandEvaluator.handValues.highCard &&
                         secondhandEvaluator.handValues.highCard > fourthHandEvaluator.handValues.highCard)
                {
                    Console.WriteLine("Second Hand Wins");
                }
                else if (thirdHandEvaluator.handValues.highCard > secondhandEvaluator.handValues.highCard &&
                         thirdHandEvaluator.handValues.highCard > firstHandEvaluator.handValues.highCard &&
                         thirdHandEvaluator.handValues.highCard > fourthHandEvaluator.handValues.highCard)
                {
                    Console.WriteLine("Third Hand Wins");
                }
                else if (fourthHandEvaluator.handValues.highCard > secondhandEvaluator.handValues.highCard &&
                         fourthHandEvaluator.handValues.highCard > thirdHandEvaluator.handValues.highCard &&
                         fourthHandEvaluator.handValues.highCard > firstHandEvaluator.handValues.highCard)
                {
                    Console.WriteLine("Fourth Hand Wins");
                }
                else
                {
                    Console.WriteLine("Draw, No one wins!");
                }
            }

            Console.ResetColor();
            Console.WriteLine();
        }
 //Hand class constructor
 public Hand(ref hand Handstruct)
 {
     Hstruct = Handstruct;
 }// end Hand constructor