1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//! The solving, checking, optimizing and comparing tutorials: one guided lesson for each function
//! that solves a design, judges it, improves it or compares it with another.
//!
//! - `solve`: Solve, auto-solve, reading the solver status (and Abandon), the overall verdict
//! and its Fix buttons, the Preform tab's proportions, and the yield and carat weight.
//! - `optimize`: Deep Solve, the Optimize tab, Retarget for a new material (Shift and Optimize)
//! and the angle sweep.
//! - `compare`: the History panel and jumping, variants, Snapshot and Compare, and Edit as Text
//! with its comparison.
//!
//! Every lesson starts from a design it can rely on (a teaching template, whose tier names are
//! fixed, or the design that is open), judges each step from the design as it is now (a tier, the
//! material, the preform, the girdle size, the inspector tab, the solve verdict), and waits for a
//! UI event only for what leaves no trace in the design (the Solve button was pressed, a result
//! list appeared, a snapshot was taken). A dialog covers the lesson's own panel while it is open,
//! so a step that sends the learner into a dialog says everything the dialog needs and waits for
//! its outcome in the design (a retarget applied, a sweep angle used, text applied) or for one
//! event, and the next step is read once the dialog is closed.
//!
//! Template designs start without a material, so every lesson whose figures need one begins with
//! a "choose the material" step. Lessons that must not be hurried along by auto-solve switch it off
//! first, and a reading step at the end puts it back.
//!
//! The tests in `solving_tests` play every lesson in a real `EditorSession`: each step's goal is
//! false before the learner's action and true after it, and the premises a lesson states about
//! the design (a girdle with no anchor does not solve, a Fix can be planned) are asserted too.
use solving_events as events;
use crate;
use ;
/// The session template index of the Standard Round Brilliant (card 1 of the New Design dialog):
/// eight tiers, a table, star and break rings, mains and a culet.
const STANDARD: usize = 1;
/// The session template index of the Rich Teaching Design (card 5): a table, a crown main ring, a
/// girdle and a pavilion main ring, every depth pinned.
const RICH: usize = 5;
/// The crown main angle of the Rich Teaching Design.
const RICH_CROWN: f64 = 34.5;
/// The pavilion main angle of the Rich Teaching Design.
const RICH_PAVILION: f64 = -40.0;
/// How close an angle must be to a wanted one to count (the tier goals' own tolerance).
const ANGLE_TOLERANCE: f64 = 0.05;
/// Solve, the auto-solve list and Undo: a lesson step that only presses Solve or reads.
const SOLVE: & = &;
/// The tier form, the tier table and Undo: a step that edits tiers.
const EDIT: & = &;
/// [`EDIT`] with Solve and its auto-solve list: a step that edits a tier and then solves.
const EDIT_SOLVE: & = &;
/// [`EDIT`] with the Advanced controls, which the Simple interface hides (the Meets kinds).
const EDIT_ADVANCED: & = &;
/// [`EDIT_ADVANCED`] with Solve: a step that edits the Meets setting and then solves.
const EDIT_ADVANCED_SOLVE: & = &;
/// The tier table, Solve and Undo: the verdict's Fix buttons need the tier table unlocked.
const FIX: & = &;
/// Design Settings (the material), Solve and Undo.
const SETTINGS: & = &;
/// The Preform tab, Solve and Undo.
const PREFORM: & = &;
/// The advanced tools (Deep Solve, Optimize, Retarget, Snapshot, Compare, Edit as Text, Angle
/// Sweep), Solve and Undo.
const TOOLS: & = &;
/// [`TOOLS`] with the tier form, for a step that changes a tier between two tool uses.
const TOOLS_EDIT: & = &;
/// Only Undo, Redo and the History tab: a step that goes through the history.
const HISTORY: & = &;
/// [`HISTORY`] with the tier form: a step that edits a tier and then looks at the history.
const HISTORY_EDIT: & = &;
/// Every solving tutorial, in the order the browser lists them.
/// A goal that waits for the UI event `name`.
/// A goal met by pressing Solve (the event) when the stone then closes (the verdict).
/// A goal that holds when `test` does. `label` says in a few words what it looks for.
const
/// The tier called `name` (case and surrounding spaces do not matter).
/// Whether the tier called `name` is at `wanted` degrees.
/// Whether the Rich Teaching Design's crown and pavilion mains are as the template made them.