From 7be6c99e58ebbda8c0884257838461505cf72d0d Mon Sep 17 00:00:00 2001
From: "Silas S. Brown" <ssb22@cam.ac.uk>
Date: Tue, 14 Apr 2020 12:44:50 +0100
Subject: [PATCH] Auto-adjust randomDropThreshold as a last resort if nothing
 could be put in the lesson (closes #3 on GitHub)

---
 gradint-build/Makefile          | 2 +-
 gradint-build/src/booktime.py   | 2 +-
 gradint-build/src/filescan.py   | 2 +-
 gradint-build/src/frontend.py   | 2 +-
 gradint-build/src/lessonplan.py | 8 +++++++-
 gradint-build/src/loop.py       | 2 +-
 gradint-build/src/makeevent.py  | 2 +-
 gradint-build/src/play.py       | 2 +-
 gradint-build/src/recording.py  | 2 +-
 gradint-build/src/sequence.py   | 2 +-
 gradint-build/src/synth.py      | 2 +-
 gradint-build/src/system.py     | 2 +-
 gradint-build/src/top.py        | 2 +-
 gradint-build/src/users.py      | 2 +-
 gradint-build/thindown.py       | 2 +-
 15 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/gradint-build/Makefile b/gradint-build/Makefile
index 2ca2624..68d15de 100644
--- a/gradint-build/Makefile
+++ b/gradint-build/Makefile
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/booktime.py b/gradint-build/src/booktime.py
index 6c74fa0..8819bdc 100644
--- a/gradint-build/src/booktime.py
+++ b/gradint-build/src/booktime.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/filescan.py b/gradint-build/src/filescan.py
index eaf1f0d..e755c01 100644
--- a/gradint-build/src/filescan.py
+++ b/gradint-build/src/filescan.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/frontend.py b/gradint-build/src/frontend.py
index 68a8d44..b41a80c 100644
--- a/gradint-build/src/frontend.py
+++ b/gradint-build/src/frontend.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/lessonplan.py b/gradint-build/src/lessonplan.py
index 9ddc2fe..b3d16b6 100644
--- a/gradint-build/src/lessonplan.py
+++ b/gradint-build/src/lessonplan.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
@@ -219,6 +219,12 @@ class ProgressDatabase(object):
         for p in poems:
             for l in p: self.do_as_poem[self.responseIndex[l]] = p
         self.addToLesson(reallyKnownThreshold,-1,1,1,-1)
+        if not self.l.events:
+            # desperado if someone really wants extra revision of few words
+            global randomDropLevel, randomDropLevel2
+            rdl,rdl2,randomDropLevel,randomDropLevel2 = randomDropLevel,randomDropLevel2,0,0
+            self.addToLesson(reallyKnownThreshold,-1,1,1,-1)
+            randomDropLevel, randomDropLevel2 = rdl,rdl2
         l = self.l ; del self.l, self.responseIndex, self.do_as_poem
         if not l.events: raise Exception("Didn't manage to put anything in the lesson")
         if commentsToAdd: l.addSequence(commentSequence(),False)
diff --git a/gradint-build/src/loop.py b/gradint-build/src/loop.py
index f428e13..db5cb9f 100644
--- a/gradint-build/src/loop.py
+++ b/gradint-build/src/loop.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/makeevent.py b/gradint-build/src/makeevent.py
index 757a1dc..b6e1e3a 100644
--- a/gradint-build/src/makeevent.py
+++ b/gradint-build/src/makeevent.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/play.py b/gradint-build/src/play.py
index 9db803b..3a89178 100644
--- a/gradint-build/src/play.py
+++ b/gradint-build/src/play.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/recording.py b/gradint-build/src/recording.py
index 919a5b0..fddcac5 100644
--- a/gradint-build/src/recording.py
+++ b/gradint-build/src/recording.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/sequence.py b/gradint-build/src/sequence.py
index cb3de14..a971a60 100644
--- a/gradint-build/src/sequence.py
+++ b/gradint-build/src/sequence.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/synth.py b/gradint-build/src/synth.py
index 7feb0f4..7ddd2a1 100644
--- a/gradint-build/src/synth.py
+++ b/gradint-build/src/synth.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/system.py b/gradint-build/src/system.py
index 700c9e3..fb1c853 100644
--- a/gradint-build/src/system.py
+++ b/gradint-build/src/system.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/src/top.py b/gradint-build/src/top.py
index 2b9ae5f..ed37b38 100644
--- a/gradint-build/src/top.py
+++ b/gradint-build/src/top.py
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 #   (Python 2 or Python 3, but more fully tested on 2)
 
-program_name = "gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+."
+program_name = "gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+."
 
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
diff --git a/gradint-build/src/users.py b/gradint-build/src/users.py
index b632d78..fe64589 100644
--- a/gradint-build/src/users.py
+++ b/gradint-build/src/users.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
diff --git a/gradint-build/thindown.py b/gradint-build/thindown.py
index 572db87..8d2ffa0 100644
--- a/gradint-build/thindown.py
+++ b/gradint-build/thindown.py
@@ -1,5 +1,5 @@
 # This file is part of the source code of
-# gradint v3.02 (c) 2002-20 Silas S. Brown. GPL v3+.
+# gradint v3.03 (c) 2002-20 Silas S. Brown. GPL v3+.
 #    This program is free software; you can redistribute it and/or modify
 #    it under the terms of the GNU General Public License as published by
 #    the Free Software Foundation; either version 3 of the License, or
-- 
GitLab