first try

Philip Miess via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 18 05:54:11 PDT 2017


On Fri, 17 Mar 2017 09:44:02 +0000, Andrea Fontana wrote:
>> // 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
Andrea,
	your right I accidentally remove the protection from duplicate 
cards during translation. I fixed that, and reacted to negative bets with 
Chicken!!.

Thanks for your help,
Phil



More information about the Digitalmars-d-learn mailing list