[gnome-taquin] Add a security.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-taquin] Add a security.
- Date: Sat, 16 Feb 2019 19:59:22 +0000 (UTC)
commit 558618717f03b918043d995ea5f444d588e6845b
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Feb 16 20:13:26 2019 +0100
Add a security.
It may happen that the game
starts in final position...
src/taquin-game.vala | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/src/taquin-game.vala b/src/taquin-game.vala
index ccdcb66..f1c331c 100644
--- a/src/taquin-game.vala
+++ b/src/taquin-game.vala
@@ -76,6 +76,11 @@ public class Game : Object
this.game_type = game_type;
tiles = new int[size, size];
+ do { generate_game (); } while (check_complete ());
+ }
+
+ private void generate_game ()
+ {
var ntiles = size * size;
var line = new int?[ntiles];
var i = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]