// Самообучающаяся игра

// Самообучающаяся игра "Угадай жив

// Самообучающаяся игра "Угадай животное".
// Старайтесь на вопрос "Чем отличается" вводить самый общий ответ
// Например: "Чем отличается чиж от ежа" - "Умеет летать"
type
TNode = class
s: string;
left,right: TNode;
constructor(s: string);
begin
Self.s := s;
left := nil;
right := nil;
end;
end;

var f: text;

/// Сохранить дерево в файл
procedure SaveToFile(p: TNode);
begin
if p=nil then
begin
writeln(f,'');
exit
end;
writeln(f,p.s);
SaveToFile(p.left);
SaveToFile(p.right);
end;

/// Загрузить дерево из файла
function LoadFromFile: TNode;
var
s: string;
p: TNode;
begin
readln(f,s);
if s='' then
begin
Result := nil;
exit
end;
p := new TNode(s);
p.left := LoadFromFile;
p.right := LoadFromFile;
Result := p;
end;

var
p,p1,p2,root: TNode;
x: integer;
s,q: string;

begin
writeln('Загадайте животное');
assign(f, 'animals_data.txt');
if not FileExists('animals_data.txt') then
root := new TNode('Собака')
else
begin
reset(f);
root := loadfromfile;
close(f);
end;

p := root;
while p.leftnil do
begin
write(p.s+'? (0 - Нет, 1 - Да): ');
readln(x);
if x=1 then
p := p.left
else
p := p.right
end;

write('Это '+p.s+'? (0 - Нет, 1 - Да): ');
readln(x);
if x=1 then
writeln('Я угадала!')
else
begin
write('Я проиграла. Что это за животное? ');
readln(s);
write('Введите вопрос, отличающий это животное от '+p.s+': ');
readln(q);
p1 := new TNode(s);
p2 := new TNode(p.s);
p.s := q;
p.left := p1;
p.right := p2;
end;
Rewrite(f);
SaveToFile(root);
Close(f);
end.
0/5000
Từ: -
Sang: -
Kết quả (Anh) 1: [Sao chép]
Sao chép!
// Самообучающаяся игра "Угадай животное". // Старайтесь на вопрос "Чем отличается" вводить самый общий ответ// Например: "Чем отличается чиж от ежа" - "Умеет летать"type TNode = class s: string; left,right: TNode; constructor(s: string); begin Self.s := s; left := nil; right := nil; end; end;var f: text;/// Сохранить дерево в файл procedure SaveToFile(p: TNode);begin if p=nil then begin writeln(f,''); exit end; writeln(f,p.s); SaveToFile(p.left); SaveToFile(p.right);end;/// Загрузить дерево из файлаfunction LoadFromFile: TNode;var s: string; p: TNode;begin readln(f,s); if s='' then begin Result := nil; exit end; p := new TNode(s); p.left := LoadFromFile; p.right := LoadFromFile; Result := p;end;var p,p1,p2,root: TNode; x: integer; s,q: string;begin writeln('Загадайте животное'); assign(f, 'animals_data.txt'); if not FileExists('animals_data.txt') then root := new TNode('Собака') else begin reset(f); root := loadfromfile; close(f); end; p := root; while p.left<>nil do begin write(p.s+'? (0 - Нет, 1 - Да): '); readln(x); if x=1 then p := p.left else p := p.right end; write('Это '+p.s+'? (0 - Нет, 1 - Да): '); readln(x); if x=1 then writeln('Я угадала!') else begin write('Я проиграла. Что это за животное? '); readln(s); write('Введите вопрос, отличающий это животное от '+p.s+': '); readln(q); p1 := new TNode(s); p2 := new TNode(p.s); p.s := q; p.left := p1; p.right := p2; end; Rewrite(f); SaveToFile(root); Close(f);end.
đang được dịch, vui lòng đợi..
Kết quả (Anh) 2:[Sao chép]
Sao chép!
. // Self-learning game "Guess the Animal"
// Try the question "What is the difference" to enter the most common response
// For example: "What is different from the siskin hedgehog" - "can fly"
of the type
TNode class =
s:: string;
left, right: TNode;
the constructor (s:: string);
the begin
Self.s: = s;
left: = nil is;
right: = nil is;
end;
end; the var f: text; /// Save the file tree in the procedure SaveToFile (p: TNode) ; the begin the if p = nil is the then the begin the writeln (f, ''); the exit end; the writeln (f, the ps); the SaveToFile (p.left); the SaveToFile (p.right); end; /// tree Upload from file function the LoadFromFile: TNode; the var s:: string; p: TNode; the begin the readln (f, s); the if s = '' the then the begin the Result: = nil is; the exit end; p: = TNode new (s); p.left: = the LoadFromFile; p.right: = the LoadFromFile; the Result: = p; end; the var p, p1, p2, root: TNode; x: integer The; s, of q:: string; the begin the writeln ( 'put forth a beast'); the assign (f, 'animals_data.txt'); the if not FileExists ( 'animals_data.txt') the then root: = new TNode ( 'dog') the else the begin the reset (f); root: = LoadFromFile; address close e-(f); end; p: = root; 'while' p.left <> nil is do the begin the write (p.s + '(0 - No 1 - Yes):?'); the readln (x); the if x = 1, the then p: = p.left the else p: p.right = end; the write ( 'It' + p.s + '? (0 - No 1 - Yes): '); the readln (x); the if x = 1, the then the writeln (' I guess')! The else the begin the write ( 'I am lost What kind of animal');.? The readln (s ); the write ( 'Enter the question that distinguishes it from the animal' p.s + + ':'); the readln (of q); p1: = TNode new (s); p2: = new TNode (the ps); the ps: of q =; p.left: = p1; p.right: = p2; end; Rewrite (f); the SaveToFile (root); the Close (f); end.


















































































đang được dịch, vui lòng đợi..
Kết quả (Anh) 3:[Sao chép]
Sao chép!
/ / самообучающаяся game "guess the animal."/ / try to question "what"s the difference between" to introduce the most common response/ / example: "what"s the difference between a siskin of hedgehog" - "fly"typeTNode = classs: string;left, right, TNode;constructor (s: string);beginSelf.s: = s;left: = nil;right: = nil;end;end;var f: text;/ / / save the tree to a fileprocedure SaveToFile (p: TNode);beginif p = nil.beginwriteln (f "").exitend;writeln (f, p.s);SaveToFile (p.left);SaveToFile (p.right);end;/ / / load a tree from a filefunction LoadFromFile: TNode;vars: string;p: TNode;beginreadln (f, s);if s = "".beginresult: = nil;exitend;p: = new TNode (s);p.left: = LoadFromFile;p.right: = LoadFromFile;result: = p;end;varp, p1, p2, root: TNode;x: integer;s, q: string;beginwriteln ("make a beast");assign (f, "animals _ data.txt");if not FileExists ("animals _ data.txt").root = new TNode ("dog")elsebeginreset (f);root: = loadfromfile;close (f);end;p: = root;while p.left < > nil.beginwrite (p.s + "? (0 -, 1 - -): ");readln (x).if x = 1 thenp: = p.leftelsep: = p.rightend;write ("+" "+ p.s? (0 -, 1 - -): ");readln (x).if x = 1 thenwriteln (i know!)elsebeginwrite ("i lost. what is this animal?) ;readln (s);write ("enter the question, distinguishes it from p.s animal "+ +": ");readln (q);p1: = new TNode (s);p2: = new TNode (p.s);p.s: = q;p.left: = p1.p.right: = p2.end;Rewrite (f);SaveToFile (root);the (f);end.
đang được dịch, vui lòng đợi..
 
Các ngôn ngữ khác
Hỗ trợ công cụ dịch thuật: Albania, Amharic, Anh, Armenia, Azerbaijan, Ba Lan, Ba Tư, Bantu, Basque, Belarus, Bengal, Bosnia, Bulgaria, Bồ Đào Nha, Catalan, Cebuano, Chichewa, Corsi, Creole (Haiti), Croatia, Do Thái, Estonia, Filipino, Frisia, Gael Scotland, Galicia, George, Gujarat, Hausa, Hawaii, Hindi, Hmong, Hungary, Hy Lạp, Hà Lan, Hà Lan (Nam Phi), Hàn, Iceland, Igbo, Ireland, Java, Kannada, Kazakh, Khmer, Kinyarwanda, Klingon, Kurd, Kyrgyz, Latinh, Latvia, Litva, Luxembourg, Lào, Macedonia, Malagasy, Malayalam, Malta, Maori, Marathi, Myanmar, Mã Lai, Mông Cổ, Na Uy, Nepal, Nga, Nhật, Odia (Oriya), Pashto, Pháp, Phát hiện ngôn ngữ, Phần Lan, Punjab, Quốc tế ngữ, Rumani, Samoa, Serbia, Sesotho, Shona, Sindhi, Sinhala, Slovak, Slovenia, Somali, Sunda, Swahili, Séc, Tajik, Tamil, Tatar, Telugu, Thái, Thổ Nhĩ Kỳ, Thụy Điển, Tiếng Indonesia, Tiếng Ý, Trung, Trung (Phồn thể), Turkmen, Tây Ban Nha, Ukraina, Urdu, Uyghur, Uzbek, Việt, Xứ Wales, Yiddish, Yoruba, Zulu, Đan Mạch, Đức, Ả Rập, dịch ngôn ngữ.

Copyright ©2024 I Love Translation. All reserved.

E-mail: