Subscribe: Calvin Hsia's WebLog
http://blogs.msdn.com/calvin_hsia/rss.aspx
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
calculate  calvin hsia  cards  code  create  hand  msdn microsoft  poker hand  poker  showed code  showed  studio  visual studio  visual  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Calvin Hsia's WebLog

Calvin Hsia's WebLog



thoughts from a professional developer



Last Build Date: Fri, 30 Mar 2018 20:40:06 +0000

 



Lasers reflecting off an ellipse

Fri, 30 Mar 2018 20:40:06 +0000

Various conic sections (hyperbolas, parabolas, ellipses) have interesting reflective properties. Parabolas are used for antennae and even car headlight and flashlight reflectors to focus a beam of light. In the last post https://blogs.msdn.microsoft.com/calvin_hsia/2018/02/28/reflect-laser-beams-off-multiple-mirrors I showed some code to bounce a laser off various mirrors that the user can draw on the screen. I also mentioned...



Reflect laser beams off multiple mirrors

Wed, 28 Feb 2018 02:33:43 +0000

In some science museums there are exhibits demonstrating the paths of light rays. A typical one might have a table with small walls consisting of blocks a few inches high, with each vertical face being a mirror. A small horizontal laser can be positioned anywhere on the table. Many blocks be placed on the table...



Store different derived classes in collections in C++ and C#: CoVariance, shared_ptr, unique_ptr

Wed, 31 Jan 2018 03:02:07 +0000

I wanted to create a collection container that would hold objects of various types, all derived from a common interface/base class.In C# and VB, this is easy. Just create a new List() and add elements to it, including various MyBase derived typesAdding elements that are more derived is Covariance (not to be confused with covariance...



Calculate Pi to measure processor performance

Sat, 30 Dec 2017 06:03:20 +0000

We know that computers can calculate very quickly, but how do we compare performance between code? I know that processors have been improving immensely since my first processor in 1971 (see https://blogs.msdn.microsoft.com/calvin_hsia/2005/10/30/my-toys-over-the-years/ ). As improvements come to processors, not all programs take advantage of them. As processor manufacturers come up with new improvements (such as...



Manipulate Visual Studio from Excel or Word

Fri, 01 Dec 2017 01:19:09 +0000

You can use automation to manipulate various applications, like Word, Excel, Visual Studio, Visual FoxProAutomation can make many tasks easier, including testing.You can imagine something like a Word macro that launches Excel to create a concordance of the words in the current Document. https://blogs.msdn.microsoft.com/calvin_hsia/2016/02/26/create-a-concordance-for-a-word-document-from-c-using-automation/ You can explore the Excel “Developer” menu by enabling it:File->Options->Customize Ribbon->Check...



The Central Limit theorem, Normal Distribution and Poker hand distributions

Tue, 31 Oct 2017 19:55:12 +0000

In Graph Poker Hand Distributions I showed some code to graph poker hands and the distributions of their values: e.g.  how many times a Pair, Full House, etc. were found in sets of one thousand random hands.It shows that the probability of a Pair is roughly 42% of deals. A royal flush was .000169%, pretty...



Create a Visual Studio Extension with minimal impact on VS startup performance

Tue, 19 Sep 2017 01:53:36 +0000

The good news: It’s very easy to create an extension in Visual Studio. The bad news: It’s also easy to make that extension have an adverse effect on the start time of Visual Studio. Let’s examine how we can mitigate the impact on Visual Studio performance. Make sure your VS Installation has installed Extensibility by...



Graph Poker Hand Distributions

Thu, 31 Aug 2017 00:38:56 +0000

Last time I showed how to Calculate Poker hand probabilities with code that showed how often a particular hand occurred, such as a Pair or a Full House. Now that we can calculate these probabilities, lets graph them. You’ll need to add references to some assemblies: System.Windows.Forms, System.Windows.Forms.DataVisualization, WindowsFormsIntegration First we’ll accumulate the results of...



Calculate Poker hand probabilities

Tue, 01 Aug 2017 01:44:42 +0000

In the last post I showed some code that displays playing cards using WPF. Now we’ll have some fun with the cards. Let’s calculate the probability of getting a particular poker hand. The program below shuffles the deck, then deals 5 cards by taking the first 5 cards into a “hand”. The hand is then...



Display Playing cards in WPF

Fri, 30 Jun 2017 00:49:38 +0000

I remember each version of Windows had new games. On Windows 3.1 many people played Solitaire. Windows for Workgroups 3.11 introduced Hearts. Somewhere along the way came FreeCell, MineSweeper and Spider Solitaire. This was years before more modern User interfaces, such as WPF existed. Windows no longer ships Cards.dll which has the images of the...