[Oberon] PO2013 - MasterMind

Michael Schierl schierlm at gmx.de
Wed Jun 10 16:51:57 CEST 2020

Hello Tomas,

Am 10.06.2020 um 15:18 schrieb Tomas Kral:
> Hi,
> Oberon is not exactly a gaming platform, yet I am
> recoding `MasterMind' game for PO2013 FPGA system.
> In the Score procedure, I use two sets {u,s} to mark pegs already
> scored. I was surprised two are needed, possibly one might be enough,
> as they do not seem disjoint.

Try to count the sum of blacks and whites (i.e. the pegs that are
correct, regardless of position). There is a straightforward algorithm
that needs only one set for that, and O(P²) time complexity like yours.
You can get the number of blacks by subtracting the number of whites

You can also get down to O(P+C) time complexity (P = number of pegs,
C = number of colors) when using an extra O(C) storage to count the
number of pegs for each color. That is how I implemented a cheat-proof
MasterMind (i. e. without side channel or timing attacks) on a
smart card ~15 years ago at university.



More information about the Oberon mailing list