Image:
 Author: DrBalk Group: Collaborations Filesize: 190.56 kB Date added: 2017-01-22 Rating: 6.1 Downloads: 233 Views: 231 Comments: 3 Ratings: 3 Times favored: 0 Made with: Algodoo v2.1.0 Tags: thyme, probe, sonde
|
Training in Thyme-script-langugage: 4-wins with automatical detection for the winner.</b>
The idea for the 4-wins comes from XRAY, the idea to do
the check-if-won-by-spawned-probes comes from FRA32, thanks to both of you!
Something about the logic inside:
A laser at the entrance of the grid changes the variable _inside to true, it is the presumption for the check of who is the winner.
If a collision of an object with another object happens, which hast a color value with red=0.9, then a scan is performed. For this scan tiny circles are spawned with collisiongroups B,C,D,E, wich are positioned along the horizontal, vertical and diagonal lines. On collision of these they chec the colorvalue of previous ones, and add 1 to a counter, if these values are the same. If they are not the same ( red follows yellow or yellow follows red ) the counter is reset to 0.
After one collision of a chip inside the grid, the variable _inside is set to false, to prevent multi-collions, as only one scan per chip should be done.
In the violet box the winnercolor will be displayed. Below of that box you can reset the last winner.
Thyme-Übung: <b>"Vier-Gewinnt mit automatischer Gewinnerkontrolle"</b>
Der Laser am Eingang des Rasters verleiht der hineinkommenden Kugel den Variablenwert _inside=true, der als Voraussetzung dafür gilt, dass ein "Gewinnercheck" durchgeführt wird.
Wenn eine Kollsion der Kugel (Kollisionsgruppen A bis E) mit einem Objekt, das den rot-Farbwert von 0.9 besitzt, geschieht, wird ein Scan-Vorgang ausgelöst. Dazu werden kleine Kugeln mit Kollisionsgruppe B, bzw. C, bzw. D, bzw. E erzeugt, die in ihrer Position entlang einer horizontalen, vertkalen, diagonalen Linie entlang mit pos positioniert werden, wobei sie bei ihren möglichen Kollisionen keine Bewegungsauswirkung auf die anderen und auch nicht auf sich selbst haben. Sie stecken dann als sehr dünne Schemen "in" den jeweiligen Kreisen, mit denen sie kollidieren. Bei ihren Kollisionen vergleichen sie die Farbwerte mit vorherigen Farbwerten und zählen einen Zähler bei Übereinstimmung hoch. Bei einem "Loch" wird die Zählvariable wieder auf 0 gesetzt.
_inside wird false gesetzt, nachdem ausgelöst wurde, um Mehrfachauslösungen zu vermeiden. Im Lilafarbenen Kasten rechts neben dem Spielplan wird der Gewinner angezeigt. Im braunen Kasten unterhalb davon kann man den "letzten Gewinner" resetten um eine weitere 4-er Reihe mit einem neuen Gewinner zu ermöglichen. |