Posts

....
Technical Blog for .NET Developers ©

Sunday, January 3, 2021

Rosetta Code

This post is an implementation of this theorem proposed by RosettaCode.org, titled 100 doors



The only doors that remain open are those whose numbers are perfect squares.
Opening only those doors is an optimization that may also be expressed; however, as should be obvious, this defeats the intent of comparing implementations across programming languages.

I wrote the next algorithm in F#, with a slight difference which lead me to discover also the theorem of the distribution of odd numbers

The type Door:



The implementation of Visit Doors, and Set Matrix Doors:



The use of this algorithm is with C#, with a set of 1000 doors to review the results



Notice the distribution patterns of odds, fibonacci, and perfect square numbers on the board




METHOD SOFTWARE