游戏分数数据的众数识别(In-Game Mode)
几何画板及绘图内容加载中,请稍等……
该范例演示如何在“游戏分数”数据列表中找出最常出现的分数,即数据的众数,并可通过动画改变随机数据后观察众数的变化。核心数学概念包括:众数(mode)作为离散数据中出现频率最高的值、数据计数(CountIf)与去重/唯一值处理(Unique)、以及对数据进行排序与统计特征提取。作图与实现要点:利用 RandomUniform 生成随机分数,再用 Take 与 Sequence 组织数据序列;通过 Unique 得到 uniqueScores,并配合 Element 从索引列表中取值(allScores、allScoreIndexOptions、currentIndices、currentScores)。用 CountIf 统计每个候选分数的出现次数,获得 modeValue(众数对应的最大频数),并用 If、Reverse、Append 等实现条件选择与数据更新;同时用 PixelsToPoint、Text、CountIf、centerBox 等将结果以标注/界面元素显示。适合 6-8 年级及入门概率统计教学,用于训练“用模式/众数描述数据”的能力,也可用于课堂练习与自学巩固。
GeoGebra 命令及参数
RandomUniform(0, 0.999, 200) → allRandomSeeds, {0.6959388293896254, 0.6502841462587158, 0.6894590037735864, 0.6925109067239651, 0.6173471139970224, 0.5818040786250765, 0.708953931426687, 0.9487680569387938, 0.5041533238284187, 0.5067909973577055, 0.698207683971174, 0.3301388661192545, 0.14454739800277247, 0.28302587611832264, 0.23277987370134945, 0.8235243591822955, 0.029753163918062733, 0.9290006121538038, 0.9002587293284752, 0.2636265993277092, 0.05630862263152074, 0.680500999486153, 0.017871297108595113, 0.9336445437734032, 0.760934014222963, 0.14053942833428065, 0.3693795015261951, 0.314932066823253, 0.9219490682835625, 0.5970812438094084, 0.9047096012743214, 0.7168247024536305, 0.1715713406599728, 0.7073705157311181, 0.05730405245557061, 0.8152511192848947, 0.259890786657066, 0.29586746735116176, 0.8113213350113597, 0.19049868220430086, 0.7468738369105961, 0.989859212382167, 0.7475378289132649, 0.038598456353596315, 0.17740167691279668, 0.7736995731320695, 0.9931300354124672, 0.15623571010565973, 0.258091961415385, 0.29237015639580743, 0.4714316189627134, 0.13987651062681863, 0.171492562338071, 0.9496370016658691, 0.8482708596744417, 0.5069282472991863, 0.8931687540680452, 0.4035011177650686, 0.3345989485357635, 0.10722433577965933, 0.33523070906149843, 0.04190994734038321, 0.8308168032727046, 0.7459380162058855, 0.17496940579410952, 0.4558094399277526, 0.9785011852288008, 0.4421902040254113, 0.503482035949672, 0.6885720654425751, 0.3171160461402689, 0.08411825307872915, 0.774476221669462, 0.26563607096010994, 0.12377437178895653, 0.5750204607216474, 0.10284325627285537, 0.6248349195286659, 0.4971896447288472, 0.7243800183950732, 0.6520860238845865, 0.5903830165299965, 0.8926223662991778, 0.24210787241746654, 0.7232759844200587, 0.939814824490908, 0.6348884640537044, 0.21122065438287185, 0.1348962704964486, 0.9783496336417341, 0.8973501403657652, 0.31839215756748007, 0.6917042641013187, 0.24417229780637575, 0.26625893231338327, 0.9303822742884275, 0.8496170925796145, 0.13198303906385223, 0.2638616708976896, 0.8452558989925215, 0.1485875736469664, 0.27387491573883743, 0.17531672803667664, 0.15855829080506226, 0.6514954885028696, 0.9581482822089628, 0.0756967010397026, 0.23820874316342902, 0.4132306085359694, 0.7530637051046395, 0.23117745388574176, 0.23681605434870498, 0.9273888258410267, 0.7507737722077177, 0.935930173182503, 0.9074027355607743, 0.6543419786375592, 0.5497537706129774, 0.4122436824635441, 0.7691531396825873, 0.9428740310676572, 0.14797719957394803, 0.6050092422780237, 0.7997720321277373, 0.127103217058922, 0.42984966799111407, 0.6038977036503353, 0.9313561182194317, 0.10702937191514746, 0.8195278366888273, 0.9113514565323291, 0.5713396351044893, 0.5017599626873546, 0.9667056497839093, 0.0008988154688603695, 0.2650786027471976, 0.30727554748866037, 0.052250048129006355, 0.4152785299007415, 0.4039842816143339, 0.061497122691811915, 0.40221171829663266, 0.1924347485125517, 0.5678077219613563, 0.7164127156245966, 0.6407242597799311, 0.505610238735194, 0.6907105873209013, 0.7681094528138388, 0.502135515809733, 0.27352631155969315, 0.7501361167180921, 0.7007401800232668, 0.7943901805436442, 0.9099920854797775, 0.0842150897231903, 0.49272959244984216, 0.7262009195463651, 0.5482343943768826, 0.7575078189764896, 0.7338956122696532, 0.9499081162101289, 0.8097813882976923, 0.637291494372268, 0.9006250295703453, 0.24413348316829925, 0.6708686014130256, 0.9333560357353545, 0.4618003451937301, 0.6913838019675462, 0.022065938215278545, 0.04336777601954998, 0.789825980376274, 0.6056533317714626, 0.2991469575555195, 0.43330050672163933, 0.3068474712647467, 0.18981199022689485, 0.9551392797728088, 0.18621847519611973, 0.8770954726596619, 0.12414609130140952, 0.5930053120975498, 0.5478227037594091, 0.26221967695683057, 0.8428447040398949, 0.30550692795970635, 0.5186447305860622, 0.3205038485058557, 0.2544920202152972, 0.1475064849816878, 0.05958665222327047, 0.7659731671806898, 0.04573910250355494, 0.6732478528196805, 0.9836654844539586, 0.48261911672408114, 0.5392842294789969, 0.1770475953904632, 0.9803235457445081}Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1) → currentRandomSeedsSequence(1 + floor((currentRandomSeeds(19 + A) * 9)), A, 1, 10) → firstDigit, {3, 5, 2, 2, 9, 8, 5, 9, 4, 4}Unique(Zip[round((100000 * (A / 10 + currentRandomSeeds(B) / 10))), A, firstDigit, B, Sequence[1, 12]]) → uniqueScoresElement(Remove[Sequence[1, 10], {order1}], 1 + floor((currentRandomSeeds(12) * 9))) → order2Element(Remove[Sequence[1, 10], {order1, order2}], 1 + floor((currentRandomSeeds(13) * 8))) → order3Element(Remove[Sequence[1, 10], {order1, order2, order3}], 1 + floor((currentRandomSeeds(14) * 7))) → order4Element(Remove[Sequence[1, 10], {order1, order2, order3, order4}], 1 + floor((currentRandomSeeds(15) * 6))) → order5Element(Remove[Sequence[1, 10], {order1, order2, order3, order4, order5}], 1 + floor((currentRandomSeeds(16) * 5))) → order6Element(Remove[Sequence[1, 10], {order1, order2, order3, order4, order5, order6}], 1 + floor((currentRandomSeeds(17) * 4))) → order7Element(Remove[Sequence[1, 10], {order1, order2, order3, order4, order5, order6, order7}], 1 + floor((currentRandomSeeds(18) * 3))) → order8Element(Remove[Sequence[1, 10], {order1, order2, order3, order4, order5, order6, order7, order8}], 1 + floor((currentRandomSeeds(19) * 2))) → order9Element(Remove[Sequence[1, 10], {order1, order2, order3, order4, order5, order6, order7, order8, order9}], 1) → order10If(Length[uniqueScores] ≥ 10, Zip[uniqueScores(A), A, {order1, order2, order3, order4, order5, order6, order7, order8, order9, order10}], backupScores) → allScoresElement(allScoreIndexOptions, 1 + floor((currentRandomSeeds(11) * Length[allScoreIndexOptions]))) → currentIndicesReverse(Sort[Zip[allScores(A), A, currentIndices]]) → currentScoresMode(currentScores) → modeValueAppend(1, Sequence[If[currentScores(A) < currentScores(A - 1), 1, 0], A, 2, Length[currentScores]]) → orderedCountSequence(Sum[Take[orderedCount, 1, A]], A, 1, Length[orderedCount]) → colorIndexPixelsToPoint((xMin, yMin), (xMax, yMax), (PXwidth, PXheight), (23, 426)) → AnchorSequence(Anchor + ((200 * windowWidth / PXwidth), (15 * windowHeight / PXheight) + (B * boxHeight)), B, Length[currentScores] - 1, 0, -1) → allClickableAnchorsZip(centerBox[boxWidth, boxHeight, A], A, allClickableAnchors) → allClickableBoxesSequence(("Score is " * currentScores(A)), A, 1, Length[currentScores]) → altCaptionsCorner(5) → layoutAppSizeZip(A ≟ modeValue(1), A, currentScores) → isModeZip((((((("" * If[showColors, (("\textcolor{" * colors(C)) * "}{"), ""]) * "") * B) * ". ") * nameOptions(A)) * If[showColors, "}", ""]), A, {order1, order2, order3, order4, order5, order6, order7, order8, order9, order10}, B, {" 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", "10"}, C, colorIndex) → playerNamesZip(If[A, B], A, isMode, B, allClickableBoxes) → highlightModeBoxesZip(Text[If[A, ("" * B), ""], C, true, true, 0, 0], A, isMode, B, currentScores, C, allClickableAnchors) → modeLabelsexpandPoly(backgroundCorners, 7, (xMin, yMin), (xMax, yMax), (PXwidth, PXheight)) → BackgroundText(("" * currentScores(animateIndex)), allClickableAnchors(animateIndex), true, true, 0, 0) → pulsingLabelCountIf(A ≟ 1, A, orderedCount) → numDifferentSequence(CountIf[A ≟ k, A, colorIndex], k, 1, 7) → bracketHeightcenterBox(boxWidth, boxHeight, allClickableAnchors(Element[{order1, order2, order3, order4, order5, order6, order7, order8, order9, order10}, animateIndex])) → pulsingBoxPolygon({currentVerts(1) + highlightOffset, currentVerts(2) + ((-x(highlightOffset)), y(highlightOffset)), currentVerts(3) - highlightOffset, currentVerts(4) + (x(highlightOffset), (-y(highlightOffset)))}) → highlightBoxAppend(RemoveUndefined[Sequence[IndexOf[A, colorIndex], A, 1, 7]], 11) → groupStartsSequence(Midpoint[allClickableAnchors(groupStarts(A)), allClickableAnchors(groupStarts(A + 1) - 1)], A, 1, Length[groupStarts] - 1) → bracketCentersZip(rightBracketBox[boxWidth, (A * boxHeight), B, (8 * windowWidth / PXwidth)], A, bracketHeight, B, bracketCenters) → rightBracketsZip(leftBracketBox[boxWidth, (A * boxHeight), B, (5 * windowWidth / PXwidth)], A, bracketHeight, B, bracketCenters) → leftBracketsZip(A + ((-160 * windowWidth / PXwidth), 0), A, allClickableAnchors) → allNameAnchorsText("\text{HIGH SCORE}", Midpoint[backgroundCorners(3), backgroundCorners(4)], true, true, 0, -1) → titleZip(Text[((("" * If[showColors, (("\textcolor{" * colors(C)) * "}{"), "{"]) * A) * "}"), B + (0, (5 * windowHeight / PXheight)), true, true, 0, 0], A, currentScores, B, allClickableAnchors, C, colorIndex) → boxLabelsZip(Text[((("" * If[showColors, (("\textcolor{" * colors(C)) * "}{"), "{"]) * A) * "}"), B + (0, (5 * windowHeight / PXheight)), true, true, 1, 0], A, playerNames, B, allNameAnchors, C, colorIndex) → nameLabelsLength(uniqueScores) → testText("\text{Click to select}", PixelsToPoint[(xMin, yMin), (xMax, yMax), (PXwidth, PXheight), (onboardingX + 25, onboardingY - 10)], true, true, 1, 0) → onboardingText
AI 绘图提示语参考
生成一个概率与统计的交互式展示界面:先在画布上用一组方块卡片表示一组离散的“高分/得分”,方块纵向排成多行,卡片上方显示每个得分,旁边用名称与颜色进行区分;再在同一区域添加一排可点击的选框,用于逐一高亮被选中的得分;同时在画面上方或中部给出标题“HIGH SCORE”,并有一行“Click to select”引导文字。用清晰的文本标注显示“modeValue/众数”对应的得分,另用高亮效果强调众数方块;还可加入一个脉动的标签用于显示当前动画指向的得分。构造顺序:先生成随机得分集合并去重,再按得分从高到低生成方块与名称/颜色标签,最后叠加众数计算结果的高亮标注与点击交互。
以上提示语为根据原始绘图命令整理而来,仅供参考。