Jump to content

  • Log In with Google      Sign In   
  • Create Account

DARSC0D3

Member Since 13 Jan 2011
Offline Last Active Dec 12 2015 05:40 PM

Posts I've Made

In Topic: How easy is it to collaborate on a game remotely?

28 December 2012 - 07:50 AM

I would say that your question is to generic and by-far not relevant for you at this point in time.
 
If you are still learning c I would not go out and start thinking about things that might happen somewhere far out in the future.  Sure it is always good to think a couple steps ahead, but this is more like a few journeys that you still have ahead of you before even start thinking about things like this.
 
It is simple fact that focus will bring you far more result when undertaking something as learning how to develop games. Best what you could do if you are willing to think so far ahead is to make sure you at least have the necessary skills set. That will give you some insight about the basic ins en outs of the process involved that you are trying to collaborate on. Without that any project is doomed to fail even before it starts. 
 
IMO this question is wasted of time for you and for people on this form trying help you out. Any answer that you will get will probably raise more questions and than answers. The missing of a foundation makes it even harder to understand what every body in this thread is talking about.

The best advice I could give to you is stick with what you are trying to learn, keep thinking few steps ahead but not years unless your skills and experience allow you to.
Make a few games on your own before even start thinking to work with other people. There are not many teams that are willing to take on apprentices as they make chance of actually finishing a product very small.
 
Armed with the knowledge of the basic principles that are involved in making games and one or more skills that could be valuable to actually work with a team on a collaborative game project you would be able to ask much better question. You might be even able to answer this question for your self for the largest part.

 

In Topic: Game from Scratch ? C++

16 December 2012 - 10:48 AM

Why won't you do a search online there are tons of game projects that have there source code publicly available.

In Topic: Virtual Coin Flip

11 October 2012 - 05:19 AM

Your performance point of view is more or less irrelevant here - performance will be dominated by the I/O performed in this function.


I was merely explaining as why I choose to do it this way and of course in a small program you probably won't have to think about such things.

Lines of code does not equate to elegance, of course. That said, I think that by removing an extra comparison alvaro's code is simpler to understand. An alternative that I think would be simpler in your code is to restructure the final condition like so:
if(repeat > 1) {
flip_coin(repeat - 1);
}
Avoiding the complex mutation expression in the condition makes the code much simpler, IMO.


I agree with you on that it would have been better to write it out like this, but on recalling the function i still have to disagree.
In this example there is little cost of recalling the function, but just out of habit not having to call a function that could be costly
I would prefer to not call a function if not needed.

In Topic: Virtual Coin Flip

11 October 2012 - 04:33 AM

This version is slightly more elegant:

import java.util.Random;

public class flip {
		static Random random_generator;
		
		static void flip_coin(int repeat) {
				if ( repeat > 0) {
					double random_number = random_generator.nextDouble();
					System.out.println(random_number);
					
					if (random_number < 0.5)
						System.out.println("head");
					else
						System.out.println("tail");

					flip_coin(repeat-1); // <-- This is the only change
				}
		}
		
		public static void main (String[] args) {
				random_generator = new Random();
				flip_coin(10);
		}
}


From a performance point of view a function call is more expensive than a comprising.
This piece of code will cause every run to have an additional function call to flip_coin with no result.
As why there is a guard condition on top this is only because if you would be silly enough to provide any value less than 1 it would just skip the function.

Less LOC's (Lines Of Code) doesn't mean it is more elegant just remember that.

In Topic: Virtual Coin Flip

11 October 2012 - 03:18 AM

Another solution might be using a recursive solution.

[source lang="java"]import java.util.Random;public class flip { static Random random_generator; static void flip_coin(int repeat) { if ( repeat > 0) { double random_number = random_generator.nextDouble(); System.out.println(random_number); if (random_number < 0.5) System.out.println("head"); else System.out.println("tail"); if(--repeat > 0) flip_coin(repeat); } } public static void main (String[] args) { random_generator = new Random(); flip_coin(10); }}[/source]

PARTNERS