• Advertisement
Sign in to follow this  

making a black jack game in C#

This topic is 2274 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

HELP ME!!!!!!!! im making a blackjack game for my computer programming class in high school. and i don't what the f#@$ im doing. so if anyone can help me or give me some pointers would be nice. the format is C#.

Share this post


Link to post
Share on other sites
Advertisement
I'm a noob but I think I could make blackjack...or I hope I could. Show me what you have so far and I'll try to help...

Share this post


Link to post
Share on other sites
using System;
using System.Collections.Generic;
using System.Text;

namespace Black_Jack
{
class Program
{
class player
{
public bool exists;
public int bet;
public int purse;
public int wins;
public int losses;
public string name;
}

class Game
{
public int numberofDecks;
public int numberOfPlayers;
}
public enum CardSuit
{
zero_error,
clubs,
diamonds,
spades,
hearts,
}

public enum CardValue
{
zero_error,
Ace,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
}
struct Card
{
public CardSuit suit; //1-4
public CardValue val; //1-13
public int CardValue;
}

public static void Main()
{
Game myGame=new Game();
player Player1= new player();
player Player2= new player();
player Player3= new player();
player Player4= new player();
player Player5= new player();

//Game introduction
Console.WriteLine("***********************************************");
Console.WriteLine("***********************************************");
Console.WriteLine("** BlackJack **");
Console.WriteLine("** The Betting Game of Men **");
Console.WriteLine("***********************************************");
Console.WriteLine("***********************************************");

//determine the parameters of the game
try
{
do
{
Console.WriteLine("\nHow many players (1-5)?");
}
while (true);
try
{
myGame.numberOfPlayers = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException)
{
if (myGame.numberOfPlayers>5|| myGame.numberOfPlayers<0)
Console.WriteLine("Number of players is out of range");
}
while (myGame.numberOfPlayers>5|| myGame.numberOfPlayers<0);

do
{
Console.WriteLine("\nHow Many Decks (1-6)?");
myGame.numberOfDecks = Convert.ToInt32(Console.ReadLine());
if (myGame.numberofDecks >6 || myGame.numberofDecks < 1)
Console.WriteLine("Error: Number of decks os out of range");
}
while(myGame.numberofDecks > 6 || myGame.numberofDecks < 1);
{
}
}
catch (FormatException)
{
Console.WriteLine("Error: Incorrect format");
}
catch (OverflowException){
}
}
}
}



[Edited by - isuckatprogramming on October 30, 2007 11:08:43 AM]

Share this post


Link to post
Share on other sites
The reason it is not working is because it is not even close to being complete.

We do not do your homework for you. Many of the people here would have to work with you in the real world if you get your degree and do you think they want to work with someone that did not even do their own homework?

We will help you with bugs and with logic problems but you have to write the code.

theTroll

Share this post


Link to post
Share on other sites
Hello,

We are not allowed to help people with their school work, especially directly with programming. If it was questions about the job, or need some ideas of what project to do we can help, but otherwise we can't. I will advise you to put classes in their own files. For example, the player and board class will each go into their own file. That just makes it nicer for people to read your code :)! Also, go find microsoft visual c# 2005 express edition for your computer. It is a free ide for the computer that you can use. When you use the debug opition in it, it will tell you the errors you have in your program, but there is a lot of things you are doing wrong. Also, search the internet for a blackjack tutorial. Ir could be in C++, Java, or C# because the syntax all closely resembled each other.

~Carl J. Loucius

Share this post


Link to post
Share on other sites
I think "Visual Basic .NET For Experienced Programmers" got example on blackjack, in VB .NET web service, if not mistaken. With little twist, you can implement it in C# console too.

But I think acddklr07 is right, you should try to work it on your own first, especially on beginner projects. Otherwise, you will learn nothing.

Share this post


Link to post
Share on other sites
Quote:
Original post by isuckatprogramming
HELP ME!!!!!!!!
im making a blackjack game for my computer programming class in high school. and i don't what the f#@$ im doing. so if anyone can help me or give me some pointers would be nice. the format is C#.

Programming takes *a lot* more time and effort than you or your teacher seem to be aware of. Even a "simple" blackjack game is not a trivial homework. I'm currently reading the book "Absolute Beginner's Guide to C" by Greg Perry (great book!) and there's a blackjack game listed in the end of it, as a conclusion to the ENTIRE book!
Programming should be fun otherwise you never will get anywhere with it.
To keep it fun, you must always have some kind of a RUNNING version.
Some kind of a program that DOES something!
Start by making a program that prints something, then get some user input.
Then build your program form there. Having a running program will keep your motivation up and will get you to learn easily.

Greetings,
Mark

Share this post


Link to post
Share on other sites
Quote:
Original post by gan
I think "Visual Basic .NET For Experienced Programmers" got example on blackjack, in VB .NET web service, if not mistaken. With little twist, you can implement it in C# console too.

But I think acddklr07 is right, you should try to work it on your own first, especially on beginner projects. Otherwise, you will learn nothing.

Yeah and microsoft had a pretty complete example too as one of it's starter kits from what I can remember. And it looked as good as the solitare game they shipped.


Share this post


Link to post
Share on other sites
BlackJack c# (????-???? - ???? ?? ?#)
http://depositfiles.com/files/jq17oo29d?redirect
http://letitbit.net/download/36189.3b717894fbb5c2b6439ea77c42a1/BLACKJACK_c_.rar.html

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement