[Community Puzzle] Genetics and Computers - Part 1

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @CrystallineCore,validated by @jordan_codingame,@GuillaumeLAURIE and @DeathMask.
If you have any issues, feel free to ping them.

1 Like

I am stuck with the last test “Round Yellow x Round Yellow”.
Could you share it ? Or help me to find what is his particularity ?

Thank you

Can you give me your code in private?
The validator is a bit long (nine genotypes), maybe your code doesn’t handle such a case.

If someone is stuck on the last test => I hadn’t understood that the ratios could be like RRyY (unsorted)


I’ve also been stuck on the last non-test validator. What is eluding me is, you are saying that ratios can be unsorted, yet from game description says, the matrix of offsprings we are calculating is sorted. “A dominant gene is always placed before a recessive gene. For example: r,R,y,Y must be written as RrYy”.
Is the last validator just a case of purposefully invalid ratios (asking for a count of unsorted gene segments from a pool of sorted ones) ? Or am I being daft once again and missing something obvious?
Thanks for any help.

Non, there are only valid ratios in the last validator but you might have to simplify it.

Validator 4 : Round Yellow x Round Yellow (RRYY * RRYY) is in fact something else?

Hi! :slight_smile:

Validator 04 “Round Yellow x Round Yellow”.
Mentioned by @Raviowitch the requested genotypes are unsorted.

Details of the inputs

They are : YYRR:YYRr:YyRR:YyRr:YYrr:Yyrr:yyRR:yyRr:yyrr
They should be : RRYY:RrYY:RRYy:RrYy:rrYY:rrYy:RRyy:Rryy:rryy

The parents “Round Yellow x Round Yellow” are now expressed “YyRr” instead of RRYY in the tests.
The parents being YyRr instead of RRYY doesnt matter for the puzzle, only the inconsistency made it even more tedious figuring this bad validator out.
@CrystallineCore, @jordan_codingame, @GuillaumeLAURIE and @DeathMask.
I think the puzzle should be removed until it’s fixed.

By submitting 136 times, I know how painful a bad validator can be.
Recaptcha also taught me how to spot and mark both tractors and fire hydrants.

If you get stuck on validator 04 “Round Yellow x Round Yellow”, just use this until its removed or fixed:


Both parents are : “YyRr”
The requested genotypes are : “YYRR:YYRr:YyRR:YyRr:YYrr:Yyrr:yyRR:yyRr:yyrr”
Requested genotypes ratio : “1:2:2:4:1:2:1:2:1” is the answer.

Take care! :slight_smile:

Sorry that you felt bad during the puzzle solving process, but I can’t see why the inputs have to be “sorted”. No constraint has been mentioned in the statement in this aspect. Having said that, I do think it is better if more test cases and validators with input strings of different character combinations are added.

It is also not good to show the contents of the validator in the forum. I have edited your message by adding spoiler tags.

hello, could you give me the test information for this 4 tests cases, please ?

    [DataRow("Wrinkled Yellow ✖ Wrinkled Green", "", "", "")]
    KO => [DataRow("Wrinkled Yellow ✖ Round Green", "", "", "")]
    [DataRow("Wrinkled Yellow ✖ Wrinkled Yellow", "", "", "")]
    KO => [DataRow("Round Yellow ✖ Round Yellow", "", "", "")]

because my solution pass the first 4 tests (all is ok)
[DataRow(“Round Yellow :heavy_multiplication_x: Round Yellow”, “RRYY RRYY”, “RRYY:rryy”,“1:0”)]
[DataRow(“Round Yellow :heavy_multiplication_x: Round Green”, “RRYY RRyy”, “RRYy:RRyy”, “1:0”)]
[DataRow(“Wrinkled Yellow :heavy_multiplication_x: Round Green”, “rrYy Rryy”, “RrYy:rrYy:rryy:Rryy”, “1:1:1:1”)]
[DataRow(“Tall Yellow :heavy_multiplication_x: Tall Green”, “TtYy Ttyy”, “TTYy:Ttyy:ttYy:ttyy:TtYy:TTyy”, “1:2:1:1:2:1”)]
public void TestAll(string caseName, string parents, string ratios,string waitingResult)
Assert.AreEqual(waitingResult, new Genetics(parents, ratios).Result(), caseName);

If your code passes all 4 tests but fails all 4 validators, then something is terribly wrong with your code. Is it not generic enough?

No i passes all 4 tests and 3/4 validators.
Could you send me the information for the “Wrinkled Yellow :heavy_multiplication_x: Round Green” validator. I would know what is wrong in my code.



I don’t see anything particular about that validator. You may PM me your code so that I can take a look.