Visual Basic Poker Code

Posted on by admin

The following Visual Basic project contains the source code and Visual Basic examples used for draw poker user control. This control calculates winning combinations for Jacks or better poker game. Joker card included.It also registers the winning cards - useful for Autohold feature. See test project. Paste the code into the code window at right. While in the VBE, choose Tools - References and put a check in MicroSoft Scripting Runtime. Close the VBE, and save the file if desired. Test the code: Run the macro by going to Tools-Macro-Macros and double-click PokerDict for the Dictionary method, or PokerColl for the Collection method. Once you've expanded the the zip file, PokerEvol.sln should load and compile in Visual Studio 2012 Express and greater. Things to note: There is a post build event that copies Poker.Equity.dll into the run directory; Poker.Equity.dll is a C library built in debug mode. However, what I'm looking for is a function (or class) written in C# or VB.NET to return a poker hand (e.g. 'Two Pair - 3s and Jacks' or 'Four Aces') from a set of cards. I've attached the VB.NET code for my structures and enums, but I can easily convert from another result format. Thus, the idea of producing a mapping between a poker hand and a small bounded entity, I thought, is worth some investigation. The code behind this article is a proof of concept of one such computational procedure. Originally, the code snippet was created in response to a 4 hour software developer test. It comprised the following task.

Write, Run & Share VB.net code online using OneCompiler's VB.net online compiler for free. It's one of the robust, feature-rich online compilers for VB.net language, running on the latest version 16. Getting started with the OneCompiler's VB.net compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as VB.net. OneCompiler also has reference programs, where you can look for the sample code to get started with.

OneCompiler's VB.net online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample VB.net program which takes name as input and prints hello message with your name.

Visual Basic is a event driven programming language by Microsoft, first released in the year 1991.

Key Features

  • Beginner's friendly language.
  • Simple and object oriented programming language.
  • User friendly language and easy to develop GUI based applications.

Variables

Variable is a name given to the storage area in order to identify them in our programs.

Simple syntax of Variable declaration is as follows

Variable initialization

Conditional Statements

1. If

2. If-else

3. If-else-if ladder

4. Nested-If

5. Select Case

Loops

1. For..Next

2. For..Each

3. While

4. Do-while

Procedures

Procedure is a sub-routine which contains set of statements. Usually Procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.

Blackjack

Procedures are of two types.

1. Functions

Functions return a value when they are called.

2. Sub-Procedures

Sub-procedures are similar to functions but they don't return any value.

-->

A sorting operation orders the elements of a sequence based on one or more attributes. The first sort criterion performs a primary sort on the elements. By specifying a second sort criterion, you can sort the elements within each primary sort group.

The following illustration shows the results of an alphabetical sort operation on a sequence of characters.

The standard query operator methods that sort data are listed in the following section.

Methods

Method NameDescriptionVisual Basic Query Expression SyntaxMore Information
OrderBySorts values in ascending order.Order ByEnumerable.OrderBy
Queryable.OrderBy
OrderByDescendingSorts values in descending order.Order By … DescendingEnumerable.OrderByDescending
Queryable.OrderByDescending
ThenByPerforms a secondary sort in ascending order.Order By …, …Enumerable.ThenBy
Queryable.ThenBy
ThenByDescendingPerforms a secondary sort in descending order.Order By …, … DescendingEnumerable.ThenByDescending
Queryable.ThenByDescending
ReverseReverses the order of the elements in a collection.Not applicable.Enumerable.Reverse
Queryable.Reverse

Query Expression Syntax Examples

Primary Sort Examples

Primary Ascending Sort

The following example demonstrates how to use the Order By clause in a LINQ query to sort the strings in an array by string length, in ascending order.

Poker Basic Strategy

Primary Descending Sort

The next example demonstrates how to use the Order By Descending clause in a LINQ query to sort the strings by their first letter, in descending order.

Secondary Sort Examples

Secondary Ascending Sort

The following example demonstrates how to use the Order By clause in a LINQ query to perform a primary and secondary sort of the strings in an array. The strings are sorted primarily by length and secondarily by the first letter of the string, both in ascending order.

Secondary Descending Sort

The next example demonstrates how to use the Order By Descending clause in a LINQ query to perform a primary sort, in ascending order, and a secondary sort, in descending order. The strings are sorted primarily by length and secondarily by the first letter of the string.

Video Poker Basics

Basic poker rules

Basic Poker Hands

See also