1/*	$NetBSD: data.c,v 1.7 2004/01/01 15:59:09 jsm Exp $	*/
2
3/*
4 * Copyright (c) 1980, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
16 *    may be used to endorse or promote products derived from this software
17 *    without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)data.c	8.1 (Berkeley) 5/31/93";
36#else
37__RCSID("$NetBSD: data.c,v 1.7 2004/01/01 15:59:09 jsm Exp $");
38#endif
39#endif				/* not lint */
40
41#include "tutor.h"
42
43int     maxmoves = 23;
44
45static const char *const text0[] = {
46	"To start the game, I roll a 3, and you roll a 1.  This means",
47	"that I get to start first.  I move 8-5,6-5 since this makes a",
48	"new point and helps to trap your back men on 1.  You should be",
49	"able to do a similar move with your roll.",
50	0
51};
52
53static const char *const text1[] = {
54	"Now you shall see a move using doubles.  I just rolled double",
55	"5's.  I will move two men from position 13 to position 3.  The",
56	"notation for this is 13-8,13-8,8-3,8-3.  You will also roll dou-",
57	"bles, but you will be able to make a much stronger move.",
58	0
59};
60
61static const char *const text2[] = {
62	"Excellent!  As you can see, you are beginning to develop a wall",
63	"which is trapping my men on position 24.  Also, moving your back",
64	"men forward not only improves your board position safely, but it",
65	"thwarts my effort to make a wall.",
66	"",
67	"My roll now is 5 6.  Normally, I would use that roll to move from",
68	"position 24 to position 13 (24-18-13), but your new point prevents",
69	"that.  Instead, I am forced to move from 13 to 2, where my man is",
70	"open but cannot be hit.",
71	0
72};
73
74static const char *const text3[] = {
75	"As you can see, although you left a man open, it is a rela-",
76	"tively safe move to an advantageous position, which might help",
77	"you make a point later.  Only two rolls (4 5 or 5 4) will allow",
78	"me to hit you.  With an unprecedented amount of luck, I happen",
79	"to roll a 4 5 and hit you as just mentioned.",
80	0
81};
82
83static const char *const text4[] = {
84	"You're pretty lucky yourself, you know.  I follow by rolling 2 3",
85	"and moving 25-22,24-22, forming a new point.",
86	0
87};
88
89static const char *const text5[] = {
90	"Not a spectacular move, but a safe one.  I follow by rolling 6 1.",
91	"I decide to use this roll to move 22-16,16-15.  It leaves me with",
92	"one man still open, but the blot is farther back on the board, and",
93	"would suffer less of a loss by being hit.",
94	0
95};
96
97static const char *const text6[] = {
98	"By moving your two men from 17 to 20, you lessen my chance of",
99	"getting my man off the board.  In fact, the odds are 5 to 4",
100	"against me getting off.  I roll with the odds and helplessly",
101	"receive a 3 5.",
102	0
103};
104
105static const char *const text7[] = {
106	"Note that the blot on 7 cannot be hit unless I get off the bar",
107	"and have a 1 or a 6 left over, and doing so will leave two of",
108	"my men open.  Also, the blot on 16 cannot be hit at all!  With",
109	"a sigh of frustration, I roll double 6's and remain immobile.",
110	0
111};
112
113static const char *const text8[] = {
114	"See, you did not get hit and, you got to 'cover up' your open men.",
115	"Quite an accomplishment.  Finally, I get off the bar by rolling",
116	"6 2 and moving 25-23,23-17.",
117	0
118};
119
120static const char *const text9[] = {
121	"My venture off the bar did not last long.  However, I got lucky",
122	"and rolled double 1's, allowing me to move 25-24,24-23,15-14,15-14.",
123	0
124};
125
126static const char *const text10[] = {
127	"You are improving your position greatly and safely, and are well",
128	"on the way to winning the game.  I roll a 6 2 and squeak past",
129	"your back man.  Now the game becomes a race to the finish.",
130	0
131};
132
133static const char *const text11[] = {
134	"Now that it is merely a race, you are trying to get as many men",
135	"as possible into the inner table, so you can start removing them.",
136	"I roll a 3 4 and move my two men farthest back to position 11",
137	"(15-11,14-11).",
138	0
139};
140
141static const char *const text12[] = {
142	"The race is still on, and you have seem to be doing all right.",
143	"I roll 6 1 and move 14-8,13-12.",
144	0
145};
146
147static const char *const text13[] = {
148	"Notice that you get to remove men the instant you have all of",
149	"them at your inner table, even if it is the middle of a turn.",
150	"I roll 1 2 and move 13-11,12-11.",
151	0
152};
153
154static const char *const text14[] = {
155	"Although you could have removed a man, this move illustrates two",
156	"points:  1) You never have to remove men, and 2) You should try",
157	"to spread out your men on your inner table.  Since you have one",
158	"man on each position, you should be able to remove at least two",
159	"men next turn.  I roll 2 5 and move 8-6,11-6.",
160	0
161};
162
163static const char *const text15[] = {
164	"This time you were able to remove men.  I roll 3 4 and move",
165	"11-7,11-8.  The race continues.",
166	0
167};
168
169static const char *const text16[] = {
170	"More holes are opening up in your inner table, but you are",
171	"still very much ahead.  If we were doubling, you would have",
172	"doubled long ago.  I roll 2 6 and move 8-6,11-5.",
173	0
174};
175
176static const char *const text17[] = {
177	"It pays to spread out your men.  I roll 3 5 and move 7-4,8-3.",
178	0
179};
180
181static const char *const text18[] = {
182	"You can only remove some men, but you spread out more and",
183	"more, in order to be able to remove men more efficiently.",
184	"I roll double 3's, which help, but not that much.  I move",
185	"8-5,3-0,3-0,3-0.",
186	0
187};
188
189static const char *const text19[] = {
190	"I roll 1 4 and move 5-4,4-0.",
191	0
192};
193
194static const char *const text20[] = {
195	"You are now nicely spread out to win a game.  I roll 5 6 and",
196	"move 5-0,6-0.",
197	0
198};
199
200static const char *const text21[] = {
201	"Any minute now.  Just a few short steps from victory.  I roll",
202	"2 4 and move 6-4,4-0.",
203	0
204};
205
206static const char *const text22[] = {
207	"It looks pretty hopeless for me, but I play on, rolling 1 3 and",
208	"moving 4-3,3-0.",
209	0
210};
211
212static const char *const text23[] = {
213	"Congratulations!  You just won a game of backgammon against the",
214	"computer!  You will now be able to play a game, but remember,",
215	"when you start playing, that doubling will be enabled, which",
216	"will add another factor to the game...  Good luck!!",
217	"",
218	0
219};
220
221const struct situatn test[] = {
222	{
223		{0, 2, 0, 0, 0, 0, -5, 0, -3, 0, 0, 0, 5, -5, 0, 0, 0, 3, 0,
224		    5, 0, 0, 0, 0, -2, 0},
225		3, 1, {8, 6, 0, 0}, {5, 5, 0, 0}, 4, 2, {text0}
226	},
227	{
228		{0, 2, 0, 0, 0, -2, -4, 0, -2, 0, 0, 0, 5, -5, 0, 0, 0, 2, 0,
229		    4, 0, 2, 0, 0, -2, 0},
230		5, 5, {13, 13, 8, 8}, {8, 8, 3, 3}, 6, 6, {text1}
231	},
232	{
233		{0, 0, 0, -2, 0, -2, -4, 2, -2, 0, 0, 0, 3, -3, 0, 0, 0, 2, 2,
234		    4, 0, 2, 0, 0, -2, 0},
235		6, 5, {13, 8, 0, 0}, {8, 2, 0, 0}, 1, 2, {text2}
236	},
237	{
238		{0, 0, -1, -2, 0, -2, -4, 2, -2, 0, 0, 0, 2, -2, 0, 1, 0, 2,
239		    2, 4, 0, 2, 0, 0, -2, 0},
240		4, 5, {24, 20, 0, 0}, {20, 15, 0, 0}, 2, 5, {text3}
241	},
242	{
243		{0, 0, 0, -2, 0, -2, -4, 3, -2, 0, 0, 0, 2, -2, 0, -1, 0, 2,
244		    2, 4, 0, 2, 0, 0, -1, -1},
245		2, 3, {25, 24, 0, 0}, {22, 22, 0, 0}, 4, 1, {text4}
246	},
247	{
248		{0, 0, 0, -2, 0, -2, -4, 2, -2, 0, 0, 0, 3, -2, 0, -1, 0, 2,
249		    2, 4, 0, 2, -2, 0, 0, 0},
250		6, 1, {22, 16, 0, 0}, {16, 15, 0, 0}, 3, 3, {text5}
251	},
252	{
253		{0, 0, 0, -2, 0, -2, -4, 2, -2, 0, 0, 0, 3, -2, 0, -2, 0, 0,
254		    2, 2, 2, 2, 2, 0, 0, -1},
255		3, 5, {0, 0, 0, 0}, {0, 0, 0, 0}, 5, 4, {text6}
256	},
257	{
258		{0, 0, 0, -2, 0, -2, -4, 1, -2, 0, 0, 0, 3, -2, 0, -2, 1, 0,
259		    2, 2, 2, 2, 2, 0, 0, -1},
260		6, 6, {0, 0, 0, 0}, {0, 0, 0, 0}, 3, 6, {text7}
261	},
262	{
263		{0, 0, 0, -2, 0, -2, -4, 0, -2, 0, 0, 0, 3, -2, 0, -2, 2, 0,
264		    2, 2, 2, 2, 2, 0, 0, -1},
265		2, 6, {25, 23, 0, 0}, {23, 17, 0, 0}, 5, 1, {text8}
266	},
267	{
268		{0, 0, 0, -2, 0, -2, -4, 0, -2, 0, 0, 0, 2, -2, 0, -2, 2, 0,
269		    3, 2, 2, 2, 2, 0, 0, -1},
270		1, 1, {25, 24, 15, 15}, {24, 23, 14, 14}, 4, 6, {text9}
271	},
272	{
273		{0, 0, 0, -2, 0, -2, -4, 0, -2, 0, 0, 0, 0, -2, -2, 0, 3, 0,
274		    4, 2, 2, 2, 2, -1, 0, 0},
275		6, 2, {23, 17, 0, 0}, {17, 15, 0, 0}, 1, 3, {text10}
276	},
277	{
278		{0, 0, 0, -2, 0, -2, -4, 0, -2, 0, 0, 0, 0, -2, -2, -1, 2, 0,
279		    3, 4, 2, 2, 2, 0, 0, 0},
280		4, 3, {15, 14, 0, 0}, {11, 11, 0, 0}, 5, 3, {text11}
281	},
282	{
283		{0, 0, 0, -2, 0, -2, -4, 0, -2, 0, 0, -2, 0, -2, -1, 0, 0, 0,
284		    3, 5, 2, 3, 2, 0, 0, 0},
285		6, 1, {14, 13, 0, 0}, {8, 12, 0, 0}, 4, 4, {text12}
286	},
287	{
288		{0, 0, 0, -2, 0, -2, -4, 0, -3, 0, 0, -2, -1, -1, 0, 0, 0, 0,
289		    0, 5, 2, 2, 5, 0, 0, 0},
290		2, 1, {13, 12, 0, 0}, {11, 11, 0, 0}, 2, 1, {text13}
291	},
292	{
293		{0, 0, 0, -2, 0, -2, -4, 0, -3, 0, 0, -4, 0, 0, 0, 0, 0, 0,
294		    0, 5, 2, 2, 3, 1, 1, 0},
295		2, 5, {8, 11, 0, 0}, {6, 6, 0, 0}, 6, 3, {text14}
296	},
297	{
298		{0, 0, 0, -2, 0, -2, -6, 0, -2, 0, 0, -3, 0, 0, 0, 0, 0, 0,
299		    0, 4, 2, 2, 2, 1, 1, 0},
300		4, 3, {11, 11, 0, 0}, {7, 8, 0, 0}, 2, 5, {text15}
301	},
302	{
303		{0, 0, 0, -2, 0, -2, -6, -1, -3, 0, 0, -1, 0, 0, 0, 0, 0, 0,
304		    0, 4, 1, 2, 2, 0, 1, 0},
305		2, 6, {8, 11, 0, 0}, {6, 5, 0, 0}, 6, 1, {text16}
306	},
307	{
308		{0, 0, 0, -2, 0, -3, -7, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
309		    0, 3, 1, 2, 2, 0, 0, 0},
310		5, 3, {8, 7, 0, 0}, {3, 4, 0, 0}, 5, 2, {text17}
311	},
312	{
313		{0, 0, 0, -3, -1, -3, -7, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
314		    0, 3, 0, 1, 2, 1, 0, 0},
315		3, 3, {8, 3, 3, 3}, {5, 0, 0, 0}, 1, 6, {text18}
316	},
317	{
318		{0, 0, 0, 0, -1, -4, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319		    1, 1, 1, 2, 1, 0, 0},
320		1, 4, {4, 5, 0, 0}, {0, 4, 0, 0}, 2, 3, {text19}
321	},
322	{
323		{0, 0, 0, 0, -1, -3, -7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
324		    1, 1, 1, 1, 0, 0, 0},
325		5, 6, {6, 5, 0, 0}, {0, 0, 0, 0}, 1, 4, {text20}
326	},
327	{
328		{0, 0, 0, 0, -1, -2, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
329		    1, 0, 1, 1, 0, 0, 0},
330		2, 4, {4, 6, 0, 0}, {0, 4, 0, 0}, 6, 2, {text21}
331	},
332	{
333		{0, 0, 0, 0, -1, -2, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
334		    0, 0, 0, 1, 1, 0, 0},
335		3, 1, {4, 3, 0, 0}, {3, 0, 0, 0}, 4, 3, {text22}
336	},
337	{
338		{0, 0, 0, 0, 0, -2, -5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
339		    0, 0, 0, 0, 0, 0, 0},
340		0, 0, {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, {text23}
341	}
342};
343