10 Replies - 11279 Views - Last Post: 02 July 2011 - 10:00 PM Rate Topic: -----

#1 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

My First Semester's Assignment: Game Project, Suggestion?

Posted 26 June 2011 - 02:28 AM

Im in my first year of college and still struggling to learning programming, expecially on C++.
And i have got a hard time to learn programming, though. And i got some assignment about using
structure data for making game. I've already got in my mind what i want to create is Text-based Games, because
its looks like interesting to me who like writing some stories. So maybe anyone can help me or give me
some suggestion what kind of features that using structure data to create some unique in my Text-based games.
What i've done just this morning was only create some typewriting effect on my game and the problems is that effect didnt use
any kind of structure data theory that i learned, so any suggestion, what kind of features i must use? and what kind of structure data is must i use?



Thanks, for any help.
By the way, im new in this forum.
Greetings ALL,

Rady Naraya

Is This A Good Question/Topic? 0
  • +

Replies To: My First Semester's Assignment: Game Project, Suggestion?

#2 zbora23  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 57
  • Joined: 26-February 09

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 26 June 2011 - 11:00 AM

Hello There,

I have an idea for you. I have wrote simple game for the first assignment of my programming class at University.
The game story goes like this:

You are stranded on an island, the boat leaves in 10 days time, a ticket costs $1000. The only way to earn money is to catch and sell lobsters. You have been given one boat and 10 lobster pots. You can choose to place your pots in the harbour waters or out in the open sea. A boat can carry you and 20 pots; you can make only one trip out per day to place your pots. On a calm day in harbour each pot will earn you $2, in the open sea $8. On a stormy day in harbour you will earn $4 but out at sea you will catch nothing and lose your pot. Additional pots can be bought for $5 each. Boats can be bought for $100 (assume you can get friend(s) to sail them). After your last catch on the tenth day you can sell your pots for $4 and boats for $80 each. The weather is determined by the throw of a dice(random function). In spring & autumn scores 1, 2 and 3 indicate a calm day, 5 and 6 a stormy day. A 4 indicates the same weather as the previous day (yesterday was calm at the start). The scores for other seasons are shown in the table below. Can you earn enough money to buy a ticket home?

Hope this helps. Let me know if you need any help :)
David

PS. it a simple game to write that encourages you to apply data structures into it.

This post has been edited by zbora23: 26 June 2011 - 11:02 AM

Was This Post Helpful? 2
  • +
  • -

#3 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 27 June 2011 - 12:09 AM

View Postzbora23, on 26 June 2011 - 11:00 AM, said:

Hello There,

I have an idea for you. I have wrote simple game for the first assignment of my programming class at University.
The game story goes like this:

You are stranded on an island, the boat leaves in 10 days time, a ticket costs $1000. The only way to earn money is to catch and sell lobsters. You have been given one boat and 10 lobster pots. You can choose to place your pots in the harbour waters or out in the open sea. A boat can carry you and 20 pots; you can make only one trip out per day to place your pots. On a calm day in harbour each pot will earn you $2, in the open sea $8. On a stormy day in harbour you will earn $4 but out at sea you will catch nothing and lose your pot. Additional pots can be bought for $5 each. Boats can be bought for $100 (assume you can get friend(s) to sail them). After your last catch on the tenth day you can sell your pots for $4 and boats for $80 each. The weather is determined by the throw of a dice(random function). In spring & autumn scores 1, 2 and 3 indicate a calm day, 5 and 6 a stormy day. A 4 indicates the same weather as the previous day (yesterday was calm at the start). The scores for other seasons are shown in the table below. Can you earn enough money to buy a ticket home?

Hope this helps. Let me know if you need any help :)
David

PS. it a simple game to write that encourages you to apply data structures into it.



Thanks for your suggestion Mr.David. Looks like i'll take your idea . So, after i read, your game likely simulation game that i really needed, really, THanks you so much. So, firstly that i though after read all, that i must create simple dice program first, so i created it become 2 dice. Then, i want to implement the "Days Feature", you know,program that recognize when days we are now. First day, tenth day, and so on. So, the question is, because this is really my first experience creating some game, can you give me some suggestion how to create those "day feature" code, maybe you can give me point what kind of structure data theory i must use to create "day feature", is linked list? or others?
Was This Post Helpful? 0
  • +
  • -

#4 zbora23  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 57
  • Joined: 26-February 09

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 27 June 2011 - 08:02 AM

Hey There,

First of all I'll tell you what I did. To gain more experience with programming I have created procedural game, implementing only basic features( placing pots in the harbour, at the open sea, selling/buying items ). After I had basic functionality I have started implementing more 'advanced' stuff e.g. different weather on different days etc. After this stage I have had working text-based game, also I got myself into 'C++ Thinking', which helps. So I had this basic game and I have started to introduce stuff like structures and classes, e.g. class called Player which held data i.e. amount of money, amount of assets etc. After Implementation of these features(classes and structures, and more object-oriented programming) you can start implementing additional features to the game like '2 players' or extended game play to '15 days'.

For the basic game in terms of days I have packed everything into one big for loop that is being repeated 10 times. Later on I have added this into class. Then you can implement features like recognition of today's date.

For the start keep it simple then add onto it. The game is really simple and in terms of C++ should not take more than 400 lines of code.

Hope this helps.
David.
Was This Post Helpful? 1
  • +
  • -

#5 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 27 June 2011 - 08:57 AM

Wow, Thanks Mr.David for the suggestion you made. i too thinked about how to learn "C++ thinking" its just different compared to my normal way of thinking. So, basically i just need to create the basic program that i can, then after some time i can improve it on the features. So, i must get the way of C++thinking by experiencing it. A moment ago i just thinking like you, that i can create loop that represent the day, but the differences is that im not trying it, i just thinking to tried the other way that im still not master it, although there is simple way like loop, bigg loopp. Hehehe. really, its gonna be big looooop,from what i think.
Thank So Much, Mr David! Now im really eager to finish this game.
Was This Post Helpful? 0
  • +
  • -

#6 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 27 June 2011 - 10:17 AM

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;

#define DICE 2
#define MAX 10

int pot,boat;

int dice()
{
	int d[DICE], i, total=0;
	srand((unsigned int)time(NULL));
	for(i=0;i<DICE;++i)
	{
		d[i]=rand()%6+1;
		total+=d[i];
		printf("Dadu ke%d adalah %d\n",i+1,d[i]);
	}
	printf("\nYour dice is %d\n", total);
	return 0;
}

int initialize()
{
	pot=10;
	boat=1;
	return 0;
}

int store(int temp,int fboat)
{
	int buy;
	int answer;
	while(1){
	printf("\nWant to buy some pots or boats?\n");
	printf("1.Pots\n");
	printf("2.Boats\n");
	cout<<"What you want to buy?";
	cin>>buy;
	switch(buy)
	{
	case 1:
		temp=temp+1;
		printf("Now your pot are %d\n",temp);
		break;
	case 2:
		fboat=fboat+1;
		printf("Now your boat are %d\n",fboat);
		break;
	}
		cout<<"\nWant to buy again:";
		cin>>answer;
		if("answer"=="y"){
			store(temp,fboat);
                      continue;
		}
		if("answer"=="n")
		break;
	}
	return 0;
}

void main()
{
	printf("===Lost in Island===\n");
	printf("Roll your dice!\n\n");
	dice();
	initialize();
	printf("\nYou are given %d pot and %d fishing boat for start\n",pot,boat);
	for(int i=0;i<MAX;i++)
	{
		printf("Day %d:\n",i+1);
		store(pot,boat);
	}
	
}



I need help about my code, Mr.David or anyone. Why my program above give me loop forever ? i tried editing, moving, and not any of those solving my problem. someone can help?
Was This Post Helpful? 0
  • +
  • -

#7 zbora23  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 57
  • Joined: 26-February 09

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 28 June 2011 - 07:40 AM

View Postradynaraya, on 27 June 2011 - 11:17 AM, said:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;

#define DICE 2
#define MAX 10

int pot,boat;

int dice()
{
	int d[DICE], i, total=0;
	srand((unsigned int)time(NULL));
	for(i=0;i<DICE;++i)
	{
		d[i]=rand()%6+1;
		total+=d[i];
		printf("Dadu ke%d adalah %d\n",i+1,d[i]);
	}
	printf("\nYour dice is %d\n", total);
	return 0;
}

int initialize()
{
	pot=10;
	boat=1;
	return 0;
}

int store(int temp,int fboat)
{
	int buy;
	int answer;
	while(1){
	printf("\nWant to buy some pots or boats?\n");
	printf("1.Pots\n");
	printf("2.Boats\n");
	cout<<"What you want to buy?";
	cin>>buy;
	switch(buy)
	{
	case 1:
		temp=temp+1;
		printf("Now your pot are %d\n",temp);
		break;
	case 2:
		fboat=fboat+1;
		printf("Now your boat are %d\n",fboat);
		break;
	}
		cout<<"\nWant to buy again:";
		cin>>answer;
		if("answer"=="y"){
			store(temp,fboat);
                      continue;
		}
		if("answer"=="n")
		break;
	}
	return 0;
}

void main()
{
	printf("===Lost in Island===\n");
	printf("Roll your dice!\n\n");
	dice();
	initialize();
	printf("\nYou are given %d pot and %d fishing boat for start\n",pot,boat);
	for(int i=0;i<MAX;i++)
	{
		printf("Day %d:\n",i+1);
		store(pot,boat);
	}
	
}



I need help about my code, Mr.David or anyone. Why my program above give me loop forever ? i tried editing, moving, and not any of those solving my problem. someone can help?



Hi There,

I assume that you infinate loop is within the following function:
int store(int temp,intfboat) { ... }


if yes, the problem is following you had some mistakes with your code.

here is corrected code with few comments from me :)
int store(int temp,int fboat)
{
	int buy;
	int answer;

	// Addition of char variable
	char answer2;

	while(1){
		printf("\nWant to buy some pots or boats?\n");
		printf("1.Pots\n");
		printf("2.Boats\n");
		cout << "What you want to buy?";

		cin>>buy;

		switch(buy){

				case 1:
					temp = temp + 1;
					printf( "Now your pot are %d\n" , temp );
					break;
				case 2:
					fboat = fboat+1;
					printf( "Now your boat are %d\n" , fboat );
					break;
		}

		cout << "\nWant to buy again:";

		//Use of answer2 below instead of answer
		cin >> answer2;

		//notice below answer2 is not in quotation marks "",and y or n are not in "" marks but in '' marks.
		if(answer2 == 'y'){
			store( temp , fboat );
			continue;
		}
		if(answer2 == 'n') break;
	}
	return 0;
}




I have tested this code personally and it works.

Hope this helps

David
Was This Post Helpful? 1
  • +
  • -

#8 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 30 June 2011 - 08:23 AM

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;

#define DICE 2
#define MAX 200

int pot,boat,dollar;
int seapot,harpot;
int wth;
int total;

int dice()
{
	int d[DICE], i;
	total=0;
	srand((unsigned int)time(NULL));
	cout<<"Its Time for DICE!!!!!\n";
	for(i=0;i<DICE;++i)
	{
		d[i]=rand()%6+1;
		total+=d[i];
		printf("Dadu ke%d adalah %d\n",i+1,d[i]);
	}
	printf("\nYour dice is %d\n", total);
	return 0;
}
int weather(int tdice)
{
	if(tdice==2||tdice==3||tdice==7||tdice==8||tdice==9){
		cout<<"The weathers now calm. Its great for catching lobster\n";
		wth=1;}
	if(tdice==5||tdice==6||tdice==11||tdice==12){
		cout<<"The weathers now stormy. Its really bad for our business\n";
		wth=2;}
	else
		cout<<"Looks like the weather is same as yesterday\n";
	return 0;
}
int initialize()
{
	pot=10;
	boat=1;
	dollar=0;
	seapot=0;
	harpot=0;
	return 0;
}

int store(int temp,int fboat)
{
	int buy;
	char answer;
	while(1){
	printf("\nWant to buy some something?\n");
	printf("1.Pots $5 each\n");
	printf("2.Boats $20 each\n");
	cout<<"What you want to buy?";
	cin>>buy;
	switch(buy)
	{
	case 1:
		if(dollar>=5){
		temp=temp+1;
		printf("Now your pot are %d\n",temp);}
		else cout<<"You dont have enough money\n";
		break;
	case 2:
		if(dollar>=20){
		fboat=fboat+1;
		printf("Now your boat are %d\n",fboat);}
		else cout<<"You dont have enough money\n";
		break;
	}
		cout<<"\nWant to buy again:";
		cin>>answer;
		if(answer=='y'){
			store(temp,fboat);
			continue;
		}
		if(answer=='n')
		break;
	}
	return 0;
}

int work(int pots, int fboat)
{
	cout<<"Where do you want to go to put your pot\n";
	cout<<"1.Go to Harbour\n";
	cout<<"2.Go to Open Sea\n";
	int answer;
	int i;
	cin>>answer;
	switch(answer)
	{
	case 1:
		cout<<"You go to harbour to put one pot\n";
		pots=pots-1;
		harpot++;
		cout<<"Your pots now "<<pots<<"\n";
		break;
	case 2:
		for(i=1;i<=fboat;i++){
			cout<<"The fishing boat no."<<i<<" go to open sea to put one pot\n";
			pots=pots-1;
			seapot++;
			cout<<"Your pots now "<<pots<<"\n";
		}
	}
	return 0;
}
int status()
{
	cout<<"The pot you put on opensea are "<<seapot<<"\n";
	cout<<"The pot you put on harbour are "<<harpot<<"\n";
	cout<<"YOUR DOLLAR NOW "<<dollar<<" $\n";
	return 0;
}
int pay()
{
	cout<<"\nPendapatan anda:\n";
	if(seapot==0||harpot==0){
		cout<<"There is no payment\n";
	}
	if(seapot>0){
		for(int i=1;i<=seapot;i++){
			if(wth==1){
				dollar=dollar+(4*i);}
			else if(wth==2){
				dollar=dollar+(2*i);}
		}
		cout<<"You got payment $4 every Pot at Calm Days and $2 every pot at Stromy Days\n";
		cout<<"You got total "<<dollar<<" from Opensea pots\n";
	}
	if(harpot>0){
		for(int j=1;j<=harpot;j++){
			if(wth==1){
				dollar=dollar+(4*j);}
			else if(wth==2){
				dollar=dollar+(1*j);}
		}
		cout<<"You got payment $2 every Pot in harbour\n";
		cout<<"You got total "<<dollar<<" from Harbour pots\n";
	}
	cout<<"Now you have "<<dollar<<" dollar\n";
	return 0;
}
int objective()
{
	cout<<"This is the tenth days.. \n";
	if((dollar%1000)!=0) cout<<"You still dont have enough money to go home\n";
	else if((dollar%1000)==0){
		dollar=dollar-1000;
		cout<<"YOU ARE SUCCESS TO GO BACK HOME!\n";
	}
	return 0;
}

void main()
{
	printf("===Lost in Island===\n");
	printf("Roll your dice!\n\n");
	dice();
	initialize();
	printf("Currently, you have %d dollar\n",dollar);
	printf("\nYou are given %d pot and %d fishing boat for start\n",pot,boat);
	for(int i=0;i<MAX;i++)
	{
		weather(total);
		pay();
		printf("Day %d:\n",i+1);
		if(dollar==0)printf("You dont have enough money! Cannot buy from store\n");
		else if(dollar>0){
			store(pot,boat);}
		cout<<"\nNow you have "<<pot<<" pot and "<<boat<<" boat\n";
		cout<<"Next, time to work!\n";
		work(pot,boat);
		status();
		if(i%10==0) objective();
		else if(i%10!=0) cout<<"Hari Berikutnya ....\n";
		dice();
	}
	
}



So, thanks for the help, Mr. David. Now, for these codes, i managed to implement many, but can you give me some help, how can i fix the code above because its doesnt want to recognize the ten daya limit?
Was This Post Helpful? 0
  • +
  • -

#9 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 30 June 2011 - 09:24 AM

radynaraya, with all due respect if you want credit for your assignment then you should be working out what the issues are yourself without expecting others to fix your logical errors. What steps have you taken to see what the problem could be? Be more specific and we can guide you to the solution. You will never learn by handing off what you should be doing to others.
Was This Post Helpful? 3
  • +
  • -

#10 zbora23  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 57
  • Joined: 26-February 09

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 30 June 2011 - 05:28 PM

radynaraya , is right, I will give you clue of what is your problem.

You starting your loop from 0, think about your method of checking for the 10th day.
Spend some time thinking and of course share your results with us. :)

Dave.

This post has been edited by zbora23: 01 July 2011 - 04:31 AM

Was This Post Helpful? 1
  • +
  • -

#11 radynaraya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 26-June 11

Re: My First Semester's Assignment: Game Project, Suggestion?

Posted 02 July 2011 - 10:00 PM

View PostButchDean, on 30 June 2011 - 09:24 AM, said:

radynaraya, with all due respect if you want credit for your assignment then you should be working out what the issues are yourself without expecting others to fix your logical errors. What steps have you taken to see what the problem could be? Be more specific and we can guide you to the solution. You will never learn by handing off what you should be doing to others.



View Postzbora23, on 30 June 2011 - 05:28 PM, said:

radynaraya , is right, I will give you clue of what is your problem.

You starting your loop from 0, think about your method of checking for the 10th day.
Spend some time thinking and of course share your results with us. :)

Dave.


Firstly, let me say sorry because im not to specific to the problem i ask. becase at the time i post the question, im in some problem, so im not give the details my problem is. Really, sorry. Thanks and i'll try to be better in future. Today, after i check the method to check the 10th day, so i change the starting loop to 1, then i fix my code become like this:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream>
using namespace std;

#define DICE 2
#define MAX 200

int pot,boat,dollar;
int seapot,harpot;
int wth;
int total;

int dice()
{
	int d[DICE], i;
	total=0;
	srand((unsigned int)time(NULL));
	cout<<"Its Time for DICE!!!!!\n";
	for(i=0;i<DICE;++i)
	{
		d[i]=rand()%6+1;
		total+=d[i];
		printf("Dice number %d is %d\n",i+1,d[i]);
	}
	printf("\nYour dice is %d\n", total);
	return 0;
}
int weather(int tdice)
{
	if(tdice==2||tdice==3||tdice==7||tdice==8||tdice==9){
		cout<<"The weathers now calm. Its great for catching lobster\n";
		wth=1;}
	if(tdice==5||tdice==6||tdice==11||tdice==12){
		cout<<"The weathers now stormy. Its really bad for our business\n";
		wth=2;}
	else if(tdice==4||tdice==10)
		cout<<"Looks like the weather is same as yesterday\n";
	return 0;
}
int initialize()
{
	pot=10;
	boat=1;
	dollar=0;
	seapot=0;
	harpot=0;
	return 0;
}

int store(int temp,int fboat)
{
	int buy;
	char answer;
	while(1){
	printf("\nWant to buy some something?\n");
	printf("1.Pots $5 each\n");
	printf("2.Boats $20 each\n");
	cout<<"What you want to buy?";
	cin>>buy;
	switch(buy)
	{
	case 1:
		if(dollar>=5){
		temp=temp+1;
		printf("Now your pot are %d\n",temp);}
		else cout<<"You dont have enough money\n";
		break;
	case 2:
		if(dollar>=20){
		fboat=fboat+1;
		printf("Now your boat are %d\n",fboat);}
		else cout<<"You dont have enough money\n";
		break;
	}
		cout<<"\nWant to buy again:";
		cin>>answer;
		if(answer=='y'){
			store(temp,fboat);
			continue;
		}
		if(answer=='n')
		break;
	}
	return 0;
}

int work(int pots, int fboat)
{
	cout<<"Where do you want to go to put your pot\n";
	cout<<"1.Go to Harbour\n";
	cout<<"2.Go to Open Sea\n";
	int answer;
	int i;
	cout<<"Choose the number 1 or 2 : ";
	cin>>answer;
	switch(answer)
	{
	case 1:
		cout<<"You go to harbour to put one pot\n";
		pots=pots-1;
		harpot++;
		cout<<"Your pots now "<<pots<<"\n";
		break;
	case 2:
		for(i=1;i<=fboat;i++){
			cout<<"The fishing boat no."<<i<<" go to open sea to put one pot\n";
			pots=pots-1;
			seapot++;
			cout<<"Your pots now "<<pots<<"\n";
		}
	}
	return 0;
}
int status()
{
	cout<<"The pot you put on opensea are "<<seapot<<"\n";
	cout<<"The pot you put on harbour are "<<harpot<<"\n";
	cout<<"YOUR DOLLAR NOW "<<dollar<<" $\n";
	return 0;
}
int pay()
{
	cout<<"\nYour Payment:\n";
	if(seapot==0&&harpot==0){
		cout<<"There is no payment\n";
	}
	if(seapot>0){
		for(int i=1;i<=seapot;i++){
			if(wth==1){
				dollar=dollar+(4*i);}
			else if(wth==2){
				dollar=dollar+(0*i);
				seapot-=i;
			}
		}
		cout<<"You got payment $4 every Pot at Calm Days and lost your pots at Stormy Days\n";
		cout<<"You got total "<<dollar<<" from Opensea pots\n";
	}
	if(harpot>0){
		for(int j=1;j<=harpot;j++){
			if(wth==1){
				dollar=dollar+(4*j);}
			else if(wth==2){
				dollar=dollar+(1*j);}
		}
		cout<<"You got payment $4 every Pot in harbour at Calm Days and $1 at Stormy Days\n";
		cout<<"You got total $"<<dollar<<" from Harbour pots\n";
	}
	cout<<"Now you have "<<dollar<<" dollar\n";
	return 0;
}
int objective()
{
	cout<<"This is the tenth days.. \n";
	if((dollar%1000)!=0) cout<<"You still dont have enough money to go home\n";
	else if((dollar%1000)==0){
		dollar=dollar-1000;
		cout<<"YOU ARE SUCCESS TO GO BACK HOME!\n";
	}
	return 0;
}

void main()
{
	printf("===Lost in Island===\n");
	cout<<"The Game Objective is to escape from the island, the only way to get out from the island are by Boat that\n";
	cout<<"leave every ten days with ticket priced 1000$. Youre are given job to catch lobsters, and only by doing the\n";
	cout<<"job, you can save the money to buy the ticket.\n";
	cout<<"\nNow! Decided the weather first by dice!\n";
	printf("Roll your dice!\n\n");
	dice();
	initialize();
	printf("Currently, you have %d dollar\n",dollar);
	printf("You are given %d pot and %d fishing boat for start\n\n",pot,boat);
	for(int i=1;i<MAX;i++)
	{
		printf("Day %d:\n",i);

		weather(total);

		cout<<"\n Store Time!\n";
		if(dollar==0)printf("You dont have enough money! Cannot buy from store\n");
		else if(dollar>0){
			store(pot,boat);}
		cout<<"\nNow you have "<<pot<<" pot and "<<boat<<" boat\n"; //why this still 10pots and 1boat even after the loop
		cout<<"Next, time to work!\n";
		work(pot,boat);
		status();
		if(i%10==0) objective();
		else if(i%10!=0) cout<<"Next Days ....\n";
		pay(); 
		dice();
	}
	
}



That i want to ask is, the initialize of pot i set before the loop, is same when the second loop happen, is this because how the loop works or maybe my code? so, like this: initialize pot=10, after i put pot in opensea in first loop, the second loop started with 10 again, not 9.

next is my method for payment, how to make use the right payment function, it like this: no matter what i change in payment function, i got weird increased of money, today i put one pot in open sea, so 4$ in payment, then next day i put another i open sea (the days all i get is calm days), so there are two pot in opensea, so i got $8, and total dollar is $12, but the total i get is $16, maybe is this the effect of the first problem above?

sorry if my question not to specific again. I'll always try to explain my question be more specific .
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1