could i see your code after you finish your game..??
could i see your code after you finish your game..??
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
Me? maybe. dunno.
and it's not going very well right now. i had to make my own swap function for my card structure, and it's not working.
i have this BASIC book that has a cool equation thing that gives the suit and value of a card from just one number. it seemed pretty cool but not very useful for a blackjack game.
this is kinda what i have.
that's pretty much what i have.Code:struct card { int value; //2 thru Ace int suit; //self explanatory. int score; //value in bj. }; typedef card CARD; void swap(CARD x, CARD y); class Deck { private: int place; //what card the deck is on. public: CARD cards[51]; //52 cards. (you need 51 there cuz of 0 - 51 is 52 numbers. Deck(); shuffle(); //more stuff. }; Deck::shuffle() { int j; for(int i = 0; i<52; i++) { j = random(52); swap(cards[i], cards[j]); } } swap(CARD x, CARD y) { CARD temp; //blah blah //here i set the values of x to temp //the values of y to x //and the values of temp to y }
NOTE: it wasn't copied directly.
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
you have a chicken in your pants....?!???
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
Yep!
im looking thru billions of posts on this board to try and figure out a way to fix my shuffle function.
i was really gettin' into this project. I even made a FLOWCHART. *gasp*
Un burro sabe mas que tu. Heh heh heh.
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
If the code is just like what you have written, I think the swap function isn't working because you are passing the cards by value. The swap function creates two new CARD variables, swaps them, then destroys them when the function is done. ChangeMe? maybe. dunno.
and it's not going very well right now. i had to make my own swap function for my card structure, and it's not working.
toCode:void swap(CARD x, CARD y);
Also, it should be cards[52] not cards[51]. The number sets aside the amount of memory to allocate, NOT the highest index. So cards[52] allocates memory for 52 cards numbered 0-51.Code:void swap(CARD &x, CARD &y);
yah i figured that out that day my dad helped me. now im working on dealing out the cards. hopefully it will work. im kinda doing a text rpg and blackjack at the same time (but im working on blackjack more).
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
maybe there is a way to get the best of both worlds..
i think it would be cool if you could incorporate blackjack in your RPG...
or maybe an RPG inside your game of blackjack...?
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
and i realized something...
character numbers 3 thru 6 are the suits...yay!
Brain: I wish I could teach u women. i don't think anyone can ('cept maybe a woman)
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
i don't think women can even teach women
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
true dat.Originally Posted by The Brain
in this song on one of my CDs it says "play it back in slow motion so I may understand the complex infrastructure known as the female mind"
here's code for the suit thing
Code:#include <iostream.h> const char suit[4] = {3, 4, 5, 6}; const char *rank[13] = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"}; int main(void) { for(int i=0; i<4; i++) { for(int j=0; j<13; j++) { cout<<suit[i]<<rank[j]<<" "; } } return 0; }
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
will const char suit[4] = {3, 4, 5, 6}; work without using ' ' char notation
ex:
const char suit[4] = {'3', '4', '5', '6'};
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
>will const char suit[4] = {3, 4, 5, 6}; work without using ' ' char notation
It will if your system prints the heart, diamond, club, and spade for values 3, 4, 5, and 6.
My best code is written with the delete key.
outstanding.
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
If anybody is interested, here are a couple of classes I wrote last year sometime dealing with cards, deck of cards, and card hands. Among other useful methods, they are set up to print pretty pictures, well as pretty as ASCII art goes anyways! You guys are welcome to use them, just don't take credit for them lol The petter-color.h file is used for the colors so be sure to include it.
code looks really good.. a bit technical.. but much bueno.
couldn't get it to compile though.....
Deleting intermediate files and output files for project 'cards - Win32 Debug'.
--------------------Configuration: cards - Win32 Debug--------------------
Compiling...
cards.cpp
fatal error C1083: Cannot open source file: 'C:\Documents and Settings\Owner\Local Settings\Temp\Temporary Directory 1 for cards.zip\cards.cpp': No such file or directory
Error executing cl.exe.
cards.exe - 1 error(s), 0 warning(s)
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel