/** * Update equities win, tie, win rank and scoop with given hand values for * the given cards. */ internal static void updateMEquities(MEquity[] meqs, OmahaEquity.EquityType eqtype, int[] hivals, String[] cards) { int hw = MEquityUtil.updateMEquities2(meqs, eqtype, hivals, cards); if (hw >= 0) { meqs[hw].scoopcount++; } }
/// <summary> /// Update equities win, tie, win rank and scoop with given hand values for the given cards. /// </summary> /// <param name="meqs"></param> /// <param name="hivals"></param> /// <param name="lovals"></param> /// <param name="cards"></param> internal static void updateMEquitiesHL(MEquity[] meqs, int[] hivals, int[] lovals, String[] cards) { // high winner int hw = MEquityUtil.updateMEquities2(meqs, OmahaEquity.EquityType.HILO_HI_HALF, hivals, cards); // low winner int lw = MEquityUtil.updateMEquities2(meqs, OmahaEquity.EquityType.HILO_AFLO8_HALF, lovals, cards); // have to win hi and low for scoop if (hw >= 0 && hw == lw) { meqs[hw].scoopcount++; } }
/// <summary> /// Calc exact tex/omaha hand equity for each hand for given board /// </summary> /// <param name="HEBoard"></param> /// <param name=""></param> /// <param name="String"></param> /// <param name=""></param> /// <returns></returns> private MEquity[] equityImpl(HEBoard heboard, String[][] holeCards) { // XXX low possible should really be a method on Value bool lowPossible; if (hilo) { if (heboard.current != null && heboard.current.Length > 2) { // only possible if there are no more than 2 high cards on board lowPossible = heboard.current.Length - lowCount(heboard.current, false) <= 2; } else { lowPossible = true; } } else { lowPossible = false; } // note: HL MEquity actually contains 3 equity types, so can be treated as high only MEquity[] meqs = MEquityUtil.createMEquitiesHL(hilo, holeCards.Length, heboard.deck.Length, heboard.Exact()); int[] hivals = new int[holeCards.Length]; int[] lovals = lowPossible ? new int[holeCards.Length] : null; String[] temp = new String[5]; // get current high hand values (not equity) if (heboard.current != null) { for (int n = 0; n < holeCards.Length; n++) { if (heboard.current.Length >= 3) { hivals[n] = heValue(value, heboard.current, holeCards[n], temp); } } MEquityUtil.updateCurrent(meqs, OmahaEquity.EquityType.HI_ONLY, hivals); if (lowPossible) { MEquityUtil.updateCurrent(meqs, OmahaEquity.EquityType.HILO_HI_HALF, hivals); // get current low values for (int n = 0; n < holeCards.Length; n++) { lovals[n] = heValue(loValue, heboard.current, holeCards[n], temp); } MEquityUtil.updateCurrent(meqs, OmahaEquity.EquityType.HILO_AFLO8_HALF, lovals); } } // get equity int count = heboard.Count(); int pick = heboard.Pick(); String[] outs = pick <= 2 ? new String[pick] : null; int hiloCount = 0; for (int p = 0; p < count; p++) { // get board heboard.Next(); //System.out.println("board p: " + p + " current: " + Arrays.toString(heboard.current) + " next: " + Arrays.toString(heboard.board)); // hi equity for (int i = 0; i < holeCards.Length; i++) { hivals[i] = heValue(value, heboard.board, holeCards[i], temp); } // low equity - only counts if at least one hand makes low bool hasLow = false; if (lowPossible) { for (int i = 0; i < holeCards.Length; i++) { int v = heValue(loValue, heboard.board, holeCards[i], temp); if (v > 0) { hasLow = true; } lovals[i] = v; } } // XXX this is ugly, should be in HEBoardEnum class only if (outs != null) { for (int n = 0; n < pick; n++) { outs[n] = heboard.board[5 - pick + n]; } } if (hasLow) { hiloCount++; MEquityUtil.updateMEquitiesHL(meqs, hivals, lovals, outs); } else { // high winner MEquityUtil.updateMEquities(meqs, OmahaEquity.EquityType.HI_ONLY, hivals, null); } } MEquityUtil.summariseMEquities(meqs, count, hiloCount); // XXX shouldn't be here, just need to store pick and count on mequity MEquityUtil.summariseOuts(meqs, pick, count); return(meqs); }