first try

Andrea Fontana via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 17 02:04:18 PDT 2017


On Friday, 17 March 2017 at 00:35:32 UTC, Philip Miess wrote:
> This is my first 100+ line D program.
> https://gitlab.com/pmiess/101gamesDlangComputerGames/blob/master/
> aceyducy.d
> Its a translation/refactor of aceyducy from 101 basic programs.
> Could someone look over it and see if I've made any glaring 
> mistakes.
> Suggestions are welcome also.
>
> Thanks,
> Phil

// Probably you mean > rather than >=
if ( card1 >= card2 ) {
     swap( card1, card2);
}


// This is an old way to avoid not-intended assigment
// but in D problem doesn't exists (and yoda notation doesn't 
work well with overloads, i think)
if ( 0 == bet )

Another problem: you doesn't check if bet is negative. So if i 
bet -1000$ and I lose my bet, i actually become richer.

Andrea


More information about the Digitalmars-d-learn mailing list