Here is what I have so far [code] Public Class PokerHands
Sub InputFormat() 'Function to remove space and change characters to UPPER CASE InputDisplay.Text = InputDisplay.Text.Replace(" ", "").Replace(",","").ToUpper End Sub
Sub FourOfaKind() 'Four of a Kind
End Sub
Sub ThreeOfaKind() 'Three of a Kind
End Sub
Sub Pair() 'A pair
End Sub
Sub Flush() 'A flush
End Sub
Sub Straight() ' A straight, if ace is low
End Sub
Sub AceStraight() 'An ace-high straight; 10, J, Q, K, A
End Sub
Private Sub InputDisplay_TextChanged(ByVal sender As Object, e As EventArgs) Handles InputDisplay.TextChanged
End Sub
Private Sub Button1_Click(ByValsender As Object, e As EventArgs) Handles Button1.Click Dim hands(4, 13) As Integer 'Example: If (2,11) = 1 then is JD Dim SuitsValue() As String = {"S", "D", "C", "H"}
Dim FaceValue() As String = {"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"} End Sub
End Class [/code]
Hi here is what I have my code so far. I am simply stuck as how to make the program reads the user input and then display the correpsonding deck. For example: if the user input "aH, AS, 2D, 3C, 4C" the program will return ace of hearts, ace of spades, two
of diamonds, three of clubs, and four of clubs? Also how can the program will recognize that the first letter (substring (0,1) is the FaceValue and the second letter substring(1,1) is the SuitsValue? I understand I will need a loop function to determine all
five. I am sorry if I am asking stupid questions here but I am really stuck!!!
Based on your description, you want to know how to use loop to judge the first letter of user input is facevalue and the second letter of user input is suitvalue. I am not familar with VB, so I use C# console application to simulate this scene. Hope it can
help you. And here is a VB sample for playing cards.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] suitvalues= { "S", "D", "C", "H" };
string[] facevalues={ "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A" };
string inputvalue=Console.ReadLine();
string inputv_1 = inputvalue.Substring(0,1);
string inputv_2 = inputvalue.Substring(1,1);
bool flag = true;
for (int i = 0; i < facevalues.Length; i++)
{
if (inputv_1 == facevalues[i])
{
Console.WriteLine("the first letter is facevalues: " + facevalues[i]);
flag=false;
break;
}
}
if (flag)
Console.WriteLine("the first letter "+inputv_1+ " is not facevalues!");
bool flag2 = true;
for (int i = 0; i < suitvalues.Length; i++)
{
if (inputv_2 == suitvalues[i])
{
Console.WriteLine("the second letter is suitvalues: " + suitvalues[i]);
flag2 = false;
break;
}
}
if (flag2)
Console.WriteLine("the second letter " + inputv_2 + " is not suitvalues!");
Console.ReadLine();
}
}
}
May
We are trying to better understand customer views on social support experience. Click HERE to participate the survey. Thanks!
None
0 Points
1 Post
Need help with poker hands code
Jul 14, 2014 05:26 AM|MORITSUKI|LINK
Here is what I have so far [code] Public Class PokerHands
Sub InputFormat() 'Function to remove space and change characters to UPPER CASE InputDisplay.Text = InputDisplay.Text.Replace(" ", "").Replace(",","").ToUpper End Sub
Sub FourOfaKind() 'Four of a Kind
End Sub
Sub ThreeOfaKind() 'Three of a Kind
End Sub
Sub Pair() 'A pair
End Sub
Sub Flush() 'A flush
End Sub
Sub Straight() ' A straight, if ace is low
End Sub
Sub AceStraight() 'An ace-high straight; 10, J, Q, K, A
End Sub
Private Sub InputDisplay_TextChanged(ByVal sender As Object, e As EventArgs) Handles InputDisplay.TextChanged
End Sub
Private Sub Button1_Click(ByValsender As Object, e As EventArgs) Handles Button1.Click Dim hands(4, 13) As Integer 'Example: If (2,11) = 1 then is JD Dim SuitsValue() As String = {"S", "D", "C", "H"}
Dim FaceValue() As String = {"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"} End Sub
End Class [/code]
Hi here is what I have my code so far. I am simply stuck as how to make the program reads the user input and then display the correpsonding deck. For example: if the user input "aH, AS, 2D, 3C, 4C" the program will return ace of hearts, ace of spades, two of diamonds, three of clubs, and four of clubs? Also how can the program will recognize that the first letter (substring (0,1) is the FaceValue and the second letter substring(1,1) is the SuitsValue? I understand I will need a loop function to determine all five. I am sorry if I am asking stupid questions here but I am really stuck!!!
Thank you very much!
Participant
1398 Points
219 Posts
Re: Need help with poker hands code
Jul 16, 2014 05:52 AM|May Wang|LINK
Hi,
Based on your description, you want to know how to use loop to judge the first letter of user input is facevalue and the second letter of user input is suitvalue. I am not familar with VB, so I use C# console application to simulate this scene. Hope it can help you. And here is a VB sample for playing cards.
http://www.dreamincode.net/forums/topic/74005-playing-cards/
May