JavaScript is required to use Bungie.net

Forums

Edited by Specops115: 12/19/2013 4:53:39 AM
2
Already put my 2 cents in but felt like solving this in C# to check the results Posting %'s for N = 13 and will post some sample code in a reply in case anyone is interested edit: oak -> of a kind [spoiler]0 4oak 0 3oak 0 2oak 13 singles = 0.0105681% 0 4oak 0 3oak 1 2oak 11 singles = 0.6182339% 0 4oak 0 3oak 2 2oak 9 singles = 6.375537% 0 4oak 1 3oak 0 2oak 10 singles = 0.5667143% 0 4oak 0 3oak 3 2oak 7 singles = 19.12661% 0 4oak 1 3oak 1 2oak 8 singles = 6.375536% 1 4oak 0 3oak 0 2oak 9 singles = 0.1180655% 0 4oak 0 3oak 4 2oak 5 singles = 18.82776% 0 4oak 1 3oak 2 2oak 6 singles = 16.73578% 0 4oak 2 3oak 0 2oak 7 singles = 1.062589% 1 4oak 0 3oak 1 2oak 7 singles = 0.7969421% 0 4oak 0 3oak 5 2oak 3 singles = 5.648327% 0 4oak 1 3oak 3 2oak 4 singles = 12.55184% 0 4oak 2 3oak 1 2oak 5 singles = 3.347157% 1 4oak 0 3oak 2 2oak 5 singles = 1.255184% 1 4oak 1 3oak 0 2oak 6 singles = 0.1859532% 0 4oak 0 3oak 6 2oak 1 singles = 0.3530205% 0 4oak 1 3oak 4 2oak 2 singles = 2.35347% 0 4oak 2 3oak 2 2oak 3 singles = 2.091973% 1 4oak 0 3oak 3 2oak 3 singles = 0.5229933% 0 4oak 3 3oak 0 2oak 4 singles = 0.154961% 1 4oak 1 3oak 1 2oak 4 singles = 0.3486622% 2 4oak 0 3oak 0 2oak 5 singles = 0.005811036% 0 4oak 1 3oak 5 2oak 0 singles = 0.0504315% 0 4oak 2 3oak 3 2oak 1 singles = 0.22414% 1 4oak 0 3oak 4 2oak 1 singles = 0.04202625% 0 4oak 3 3oak 1 2oak 2 singles = 0.09961778% 1 4oak 1 3oak 2 2oak 2 singles = 0.11207% 1 4oak 2 3oak 0 2oak 3 singles = 0.01660296% 2 4oak 0 3oak 1 2oak 3 singles = 0.00622611% 0 4oak 3 3oak 2 2oak 0 singles = 0.004669583% 1 4oak 1 3oak 3 2oak 0 singles = 0.003502187% 0 4oak 4 3oak 0 2oak 1 singles = 0.001037685% 1 4oak 2 3oak 1 2oak 1 singles = 0.004669583% 2 4oak 0 3oak 2 2oak 1 singles = 0.0008755467% 2 4oak 1 3oak 0 2oak 2 singles = 0.0003891319% 1 4oak 3 3oak 0 2oak 0 singles = 2.882459E-05% 2 4oak 1 3oak 1 2oak 0 singles = 3.242766E-05% 3 4oak 0 3oak 0 2oak 1 singles = 1.801537E-06%[/spoiler]
English

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Code - written in unity because I had it up but if you know your way around C# it shouldn't be an issue to use elsewhere should the need arise in the future [spoiler]using UnityEngine; using System.Collections; using System.Collections.Generic; public class ThrowawayPercents : MonoBehaviour { // Use this for initialization void Start () { CalcPercents(13); } // Update is called once per frame void Update () { } void CalcPercents(int N) { int n = N; Hand starting_hand = new Hand(0,0,0,1,1.0f); List<Hand> possible_hands = new List<Hand>(); possible_hands.Add(starting_hand); for(int x = 1; x < n; x++) { int starting_hand_rounds = possible_hands.Count; for(int y = 0; y < starting_hand_rounds; y++) { possible_hands.AddRange(possible_hands[0].NextPercents(x)); possible_hands.RemoveAt(0); } for(int y = 0; y < possible_hands.Count; y++) { for(int z = 0; z < possible_hands.Count; z++) { if(possible_hands[y] == possible_hands[z] && y != z) { possible_hands[y] = possible_hands[y] + possible_hands[z]; possible_hands.RemoveAt(z); z--; } } } } float sum_total = 0; string to_print = ""; for(int x = 0; x < possible_hands.Count; x++) { to_print += possible_hands[x].PrintHand(); sum_total += possible_hands[x].percent; } Debug.Log(to_print); Debug.Log("Total percent: " + sum_total); } } public class Hand { public int A; public int B; public int C; public int D; public float percent; public Hand(int new_A, int new_B, int new_C, int new_D, float new_Per) { A = new_A; B = new_B; C = new_C; D = new_D; percent = new_Per; } public static bool operator==(Hand first, Hand second) { return (first.A == second.A && first.B == second.B && first.C == second.C && first.D == second.D); } public static bool operator!=(Hand first, Hand second) { return !(first == second); } public static Hand operator+(Hand first, Hand second) { if(first == second) { return new Hand(first.A,first.B,first.C,first.D,first.percent + second.percent); } //ERROR!!!!! return new Hand(0,0,0,0,0); } public List<Hand> NextPercents(int card) { List<Hand> toReturn = new List<Hand>(); float current_percent = (float)((52 - card) - B - 2*C - 3*D)/(float)(52-card); toReturn.Add(new Hand(A,B,C,D+1,percent*current_percent)); if(D > 0) { current_percent = (float)(3*D)/(float)(52-card); toReturn.Add(new Hand(A,B,C+1,D-1,current_percent*percent)); } if(C > 0) { current_percent = (float)(2*C)/(float)(52-card); toReturn.Add(new Hand(A,B+1,C-1,D,current_percent*percent)); } if(B > 0) { current_percent = (float)(B)/(float)(52-card); toReturn.Add(new Hand(A+1,B-1,C,D,current_percent*percent)); } return toReturn; } public string PrintHand() { return "" + A + " 4oak " + B + " 3oak " + C + " 2oak " + D + " singles = " + (percent*100.0f) + "%\n"; } }[/spoiler]

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • I'll take a look later, thanks :)

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

You are not allowed to view this content.
;
preload icon
preload icon
preload icon