A few months ago, there was a Japan-made computer game that made the rounds among streamers and YouTubers called Agreeee. The game had the player go through a series of minigames ostensibly intended as part of agreeing to the game's terms of service, all before playing the actual game. (It is as frustrating as it sounds!)
I thought that particular minigame might be easy to do in Mathematica, so I tried to implement something similar to it. The code is remarkably short:
colorGame[n_Integer:10,tol_:0.02]/;n>2:=DynamicModule[{red=0.5,green=0.5,blue=0.5,chk=0,k=1,rcl},rcl=RandomColor[RGBColor,n];Panel[Grid[{{Style[Row[{"Color ",Dynamic[Min[k,n]]," of ",n}],Bold],Style[Row[{"Score: ",Dynamic[chk],"/",n}],Bold]},{Graphics[{Red,Rectangle[]},ImageSize20],Slider[Dynamic[red]]},{Graphics[{Green,Rectangle[]},ImageSize20],Slider[Dynamic[green]]},{Graphics[{Blue,Rectangle[]},ImageSize20],Slider[Dynamic[blue]]},{Framed[Dynamic[Graphics[{{rcl[[Min[k,n]]],Disk[{0,0},1]},{RGBColor[Dynamic[red],Dynamic[green],Dynamic[blue]],Disk[{2+1/4,0},1]}},ImageSizeSmall]]],SpanFromLeft},{Button["Go!",If[k≤n,If[ColorDistance[rcl[[k]],RGBColor[Setting[red],Setting[green],Setting[blue]],DistanceFunction"CIE76"]<tol,chk++];If[k==n,MessageDialog[Row[{"Game finished! Your score is ",chk,"/",n}]]];k++,MessageDialog[Row[{"Game is already finished! Your score is ",chk,"/",n}]]]],SpanFromLeft}},Alignment{{Left,Right},{Center}}]]]
Of note is the use of ColorDistance (which uses the CIE 1976 color difference) to determine how close a player's attempt is to the color being matched. The function implementing the game provides a tolerance parameter as the second argument to determine the threshold for closeness.
Here's the game in action. Can you get a high, or maybe even a perfect score?
Out[]=
That instance of the game uses the RGB colorspace. One can also write something similar for other colorspaces, like CMYK:
colorGameCMYK[n_Integer:10,tol_:0.02]/;n>2:=DynamicModule[{cyan=0.5,magenta=0.5,yellow=0.5,black=0.5,chk=0,k=1,rcl},rcl=RandomColor[CMYKColor,n];Panel[Grid[{{Style[Row[{"Color ",Dynamic[Min[k,n]]," of ",n}],Bold],Style[Row[{"Score: ",Dynamic[chk],"/",n}],Bold]},{Graphics[{Cyan,Rectangle[]},ImageSize20],Slider[Dynamic[cyan]]},{Graphics[{Magenta,Rectangle[]},ImageSize20],Slider[Dynamic[magenta]]},{Graphics[{Yellow,Rectangle[]},ImageSize20],Slider[Dynamic[yellow]]},{Graphics[{Black,Rectangle[]},ImageSize20],Slider[Dynamic[black]]},{Framed[Dynamic[Graphics[{{rcl[[Min[k,n]]],Disk[{0,0},1]},{CMYKColor[Dynamic[cyan],Dynamic[magenta],Dynamic[yellow]],Disk[{2+1/4,0},1]}},ImageSizeSmall]]],SpanFromLeft},{Button["Go!",If[k≤n,If[ColorDistance[rcl[[k]],CMYKColor[Setting[cyan],Setting[magenta],Setting[yellow],Setting[black]],DistanceFunction"CIE76"]<tol,chk++];If[k==n,MessageDialog[Row[{"Game finished! Your score is ",chk,"/",n}]]];k++,MessageDialog[Row[{"Game is already finished! Your score is ",chk,"/",n}]]]],SpanFromLeft}},Alignment{{Left,Right},{Center}}]]]
Here's what the game looks like:
Out[]=
The other minigames in Agreeee are a little more complicated to do, but I'm sure another enterprising soul can pick up where I left off.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
A game of matching colors
by J. M.
Wolfram Community, June 4, 2026
https://community.wolfram.com/groups/-/m/t/3726912
by J. M.
Wolfram Community, June 4, 2026
https://community.wolfram.com/groups/-/m/t/3726912