Welcome! |
|
|
|
|
Site Forum |
|
|
|
|
|
Topic: cpp games without graphics
|

|
| cpp games without graphics |
| << Prev Topic | Next Topic >> |
| cppgamemaker |
| Posted: 29-November-2008 at 1:21pm | IP Logged
|
|
|
Newbie

Group: Newbie
Joined: 26-November-2008 Posts: 1
|
I want to create a game without graphics...a simple game.....can any one help me with this project???...im new in cpp so i need help....u can suggest some games also which has no graphics...
thnk u
|
Online Status: Offline
|
|
| |
| Games4TheFuture |
| Posted: 04-May-2009 at 3:21pm | IP Logged
|
|
|
Super Dedicated Groupie

Group: Super Dedicated Groupie
Joined: 03-April-2006 Location: United States Posts: 91
|
Sure, there are lots of games you can start with. Games like guess my number, black jack, hangman, tic-tac-toe, a text based RPG.
|
Online Status: Offline
|
|
| |
| bradcapo2 |
| Posted: 30-July-2009 at 9:58pm | IP Logged
|
|
|
Newbie

Group: Newbie
Joined: 30-July-2009 Location: United Kingdom Posts: 1
|
I am not so knowledgeable about this matter. So i have to learn it. Thanks for the post.
le taux pour un pręt automobile donne.
|
Online Status: Offline
|
|
| |
| Robyy14 |
| Posted: 01-October-2009 at 1:34pm | IP Logged
|
|
|
Newbie

Group: Newbie
Joined: 01-October-2009 Location: Romania Posts: 3
|
Games4TheFuture wrote:
| Sure, there are lots of games you can start with. Games like guess my number, black jack, hangman, tic-tac-toe, a text based RPG. |
|
|
Here's my great tip for you : Do not go directly for games i learned simple cpp 1 year and now i made my black jack game that works perfectly to learn it visit : http://www.cplusplus.com/doc/tutorial/ oh yea here's my game : --------------------------------------------------------------------------------------- #include <iostream>
using namespace std;
void display(long cards[53]){ int i; for(i=1;i<=cards[0];i++){ cout<<cards<<" "; } }
int pack(long cards[53],int number_of_colors,int min_value,int max_value){ int i=0,color,cardcounter; for(color=1;color<=number_of_colors;color++){ for(cardcounter=min_value;cardcounter<=max_value;cardcounter++){ cards[++i]=cardcounter*10+color; } } cards[0]=i; } void switch_with_last(long cards[53],int pos){ long aux; aux=cards[cards[0]]; cards[cards[0]]=cards[pos]; cards[pos]=aux; }
int shuffle(long cards[53]){ int i,shuffles; srand(time(NULL)); for(shuffles=1;shuffles<=500;shuffles++){ i=1+rand()%cards[0]; switch_with_last(cards,i); }
}
void init_hand(long hand[10],int &hand_points){ hand_points=0; int i; for (i=0;i<=10;i++) hand=0; }
int calculate_points(long hand[10]){ int i,v,result=0; //primary calculation for (i=1;i<=hand[0];i++){ v=hand/10; if(v>11) result+=v%10; else result+=v; } //if the result is too much //try to lower it by replacing values of 11 (Aces) with 1 //until the result becomes less than or equal to 21 //if cannot lower it, return 0; if (result>21) { i=0; while(result>21 && i<hand[0]){ i++; if(hand/10==11) result-=10; } } if (result>21) return 0; else return result; }
void play(long cards[53],int counter=1){ int player_points=0,computer_points=0,computer_play=1; long player_hand[10], computer_hand[10]; init_hand(player_hand,player_points); init_hand(computer_hand,computer_points); char answer='Y'; while (answer=='Y'){ player_hand[0]++; player_hand[player_hand[0]]=cards[counter++]; player_points=calculate_points(player_hand); display(player_hand);cout<<"*"<<player_points<<"*"; if (player_points==0){cout<<"You loose";computer_play=0;break;} else {cout<<"Do you want another card? (Y/N)"; cin>>answer;} } if(computer_play) while((computer_points<17 || computer_points<=player_points) && computer_points<20){ computer_hand[0]++; computer_hand[computer_hand[0]]=cards[counter++]; computer_points=calculate_points(computer_hand); cout<<"*"<<computer_points<<"*"; if(computer_points==0) break; } //ADD COMPUTER HAND if (player_points>computer_points) cout<<"You win"; else if(player_points<computer_points) cout<<"You loose"; else cout<<"Tie"; cout<<endl; if (counter<cards[0]-8) play(cards,counter); return; } long card_pack[53]; int i; int main(){ pack(card_pack,4,2,14); shuffle(card_pack); display(card_pack); play(card_pack,5); system("Pause"); } ----------------------------------------------------------------------------- My Black Jack Game use Y/N not y/n il debug that later Hope it helped
|
Online Status: Offline
|
|
| |
| mark707 |
| Posted: 26-January-2010 at 6:50am | IP Logged
|
|
|
Newbie

Group: Newbie
Joined: 08-January-2010 Location: Austria Posts: 4
|
here is a simple 2 player tic-tac-toe
http://www.4shared.com/file/207773823/270897de/tictactoe.h
tml
|
Online Status: Offline
|
|
| |
| 1 User(s) are browsing this topic, 1 Guest(s) and 0 Member(s) |
| 0 Members: |
|
|
|
|
|
If you wish to post a reply to this topic you must first login If you are not already registered you must first register
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum
|
This page was generated in 0.2031 seconds. |