[Community puzzle] Jack Silver: The Casino Part 1

Is there something I don’t understand about this puzzle? I did the math by hand and got the same answer for the first test as my program, which was 15563. But the answer should be 1153.

[I removed the code]

There is nothing wrong, I solved it.

You were adding too much money! Here’s how this works:

You have \$4, so you will bet \$1.

If you bet on ODD and lose, you have \$3.
If you bet on ODD and win, you have \$5.
If you bet on EVEN and lose, you have \$3.
If you bet on EVEN and win, you have \$5.
If you bet on PLAIN and lose, you have \$3.
If you bet on PLAIN and win, you have \$39.

Your code does not return 3, 5, 3, 5, 3, 39 for the above scenarios. It returns 3, 6, 3, 6, 3, 40. Take another look.

• danBhentschel

Long time, but may be useful for new users. You got that result because you are adding the bet result to your full money instead of 3/4 of your money (since 1/4 was your bet).

Hello, i can’t pass the last test (0 is not even). But it is known that 0 is EVEN. Do i need to do things not based on real logic and math and consider it not EVEN here ?

As it is stated in the puzzle description :

• The target’s calls, CALL, can be one of the three possibilities:
– EVEN - He bets on an EVEN (non-zero) number
– ODD - He bets on an ODD number
– PLAIN - He bets on a specific number: NUMBER

Here the bets are similar to the roulette, 0 is a losing bet for EVEN and ODD bets :

3 Likes

Hi there,

I am validating all tests in the IDE, but when I submit I don’t validate test #7 which is not shown in the IDE.

Thanks,
Ed

Hey,
You probably missed what hemhel posted just above.
On this problem, the value 0 should not be considered as EVEN… but not as ODD neither.

Hope it helps

3 Likes

Well I found one strange thing,it is not a bug but it may cause some problems.
I try to check if it is “PLAIN” like this
Console.ReadLine().Split(’ ‘).Count() == 3 and in final test I get only 50%
After I changed it to