Click here to Skip to main content
15,897,165 members
Articles / Programming Languages / C#

More Texas Holdem Analysis in C#: Part 1

Rate me:
Please Sign up or sign in to vote.
4.96/5 (41 votes)
20 May 2008GPL310 min read 264K   4.2K   116  
Using C# to do sophisticated analysis of Texas Holdem
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HoldemHand;

namespace MultiOddsApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Pocket_TextChanged(object sender, EventArgs e)
        {
            if (Pocket.Text.Length > 0 && !Hand.ValidateHand(Pocket.Text))
            {
                Pocket.ForeColor = Color.Red;
            }
            else
            {
                Pocket.ForeColor = Color.Black;
            }

            userControl11.Pocket = Pocket.Text;
        }

        private void Board_TextChanged(object sender, EventArgs e)
        {
            if (Board.Text.Length > 0 && !Hand.ValidateHand(Board.Text))
            {
                Board.ForeColor = Color.Red;
            }
            else
            {
                Board.ForeColor = Color.Black;
            }

            userControl11.Board = Board.Text;
        }

        private void Opponents_SelectedIndexChanged(object sender, EventArgs e)
        {
            int opp = int.Parse(Opponents.Text);
            userControl11.Opponents = opp;
        }

        private void OnLoad(object sender, EventArgs e)
        {
            if (Pocket.Text.Length > 0 && !Hand.ValidateHand(Pocket.Text))
            {
                Pocket.ForeColor = Color.Red;
            }
            else
            {
                Pocket.ForeColor = Color.Black;
            }

            userControl11.Pocket = Pocket.Text;

            if (Board.Text.Length > 0 && !Hand.ValidateHand(Board.Text))
            {
                Board.ForeColor = Color.Red;
            }
            else
            {
                Board.ForeColor = Color.Black;
            }

            userControl11.Board = Board.Text;

            int opp = int.Parse(Opponents.Text);
            userControl11.Opponents = opp;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
United States United States
I work at Tektronix in Beaverton OR. I've been programming for fun since 1975 (I started while in a Computer Explorer Scout group in Spokane WA). I've been programming in C since 1979 and I've been working professionally since 1983.

I really enjoy www.codeproject.com. It has saved me an incredible amount of time. I only hope my small contributions have given back some of what I've taken.

Comments and Discussions