On Friday, 17 March 2017 at 09:04:18 UTC, Andrea Fontana wrote:
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
Anyway, on original .bas code I read:
330 IF A>=B THEN 270
That means that card1 and card2 can't be equals, but in your code
this could happen.
Andrea