changeset 10:5bb39198a9be

Always wait before starting next round.
author Mikhail Kryshen <mikhail@kryshen.net>
date Sat, 02 Apr 2016 12:24:52 +0300
parents 8c7e910cb328
children a6bde9cde187
files src/Serpentron.st
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/Serpentron.st	Tue Mar 29 22:15:05 2016 +0300
+++ b/src/Serpentron.st	Sat Apr 02 12:24:52 2016 +0300
@@ -33,10 +33,9 @@
 	self updateScore.
 	(score anySatisfy: [ :each | each >= pointsToWin ])
 		ifFalse: [
-			self status: (self winnerDOM: color) << ' won the round.'.
-			timeoutId := window
-				setTimeout: [ self nextRound ]
-				after: 2000.
+			self
+				status: (self winnerDOM: color) << ' won the round.';
+				nextRound.
 			^ self ].
 	self status: self scoreDOM.
 	timeoutId := window 
@@ -120,8 +119,11 @@
 !
 
 nextRound
-	self status: self scoreDOM.
-	field start: field players.
+	timeoutId := window
+		setTimeout: [
+			self status: self scoreDOM.
+			field start: field players ]
+		after: 2000.
 !
 
 randomizePlayerColors