Арканоид на Паскале

Àðêàiîèa ià Результаты поискаàñêàëa Ìèièñòaðñòâî îaùaãî è ïðîôaññèîiàëuiîãî îaðàçîâàièÿ ÐÔ Áaëãîðîañêàÿ Ãîñoaàðñòâaiiàÿ Òaõiîëîãè÷añêàÿ Àêàaa ìèÿ

Ñòðîèòaëuiûõ Ìàòaðèàëîâ.

Êàôaaðà Результаты поискаÎÂÒèÀÑ

Âûïîëièë:

Ñòoaaiò ôàêoëuòaòà ÀРезультаты поискаèÈÒ

Ãðoïïû Результаты поискаÂ-22

Ìàðêaëîâ Äaièñ

Ðoêîâîaèòaëu:

Áaëãîðîa – 2000.

ÑÎÄÅÐÆÀÍÈÅ

1. Результаты поискаÐÅÄÈÑËÎÂÈÅ

2. ÂÂÅÄÅÍÈÅ

3. ÇÀÄÀÍÈÅ ÊÓÐÑÎÂÎÉ ÐÀÁÎÒÛ

4. Результаты поискаÐÀÂÈËÀ Результаты поискаÎËÜÇÎÂÀÍÈb Результаты поискаÐÎÃÐÀÌÌÎÉ “ÀÐÊÀÍÎÈÄ”

5. ÈÑРезультаты поискаÎËÜÇÓÅÌÛÅ ÑÒÐÓÊÒÓÐÛ ÄÀÍÍÛÕ

6. ÈÑРезультаты поискаÎËÜÇÓÅÌÛÅ ÌÎÄÓËÈ

7. ÑРезультаты поискаÅÖÈÔÈÊÀÖÈb Результаты поискаÎÄРезультаты поискаÐÎÃÐÀÌÌ

8. ÒÅÊÑÒ Результаты поискаÐÎÃÐÀÌÌÛ È ÑÊÎÍÑÒÐÓÈÐÎÂÀÍÍÛÕ ÌÎÄÓËÅÉ

9. ïðàâèëà ïîëuçîâàièÿ aîïîëièòaëuiîe ïðîãðà ì ìîe aëÿ ïîñòðîaièÿ oðîâiae “MARKEDIT”

10. ÑРезультаты поискаÅÖÈÔÈÊÀÖÈb Результаты поискаÎÄРезультаты поискаÐÎÃÐÀÌÌ Â Результаты поискаÐÎÃÐÀÌÌÅ “MARKEDIT”

11. ÒÅÊÑÒ Результаты поискаÐÎÃÐÀÌÌÛ “MARKEDIT” È ÑÊÎÍÑÒÐÓÈÐÎÂÀÍÍÛÕ ÌÎÄÓËÅÉ

12. ÑРезультаты поискаÈÑÎÊ ÈÑРезультаты поискаÎËÜÇÓÅÌÎÉ ËÈÒÅÐÀÒÓÐÛ

Результаты поискаðaaèñëîâèa

bçûê Òoðaî Результаты поискаàñêàëu – ýòî îaèi èç ñà ìûõ ðàñïðîñòðài¸iiûõ ÿçûêîâ ïðîãðà ì ìèðîâàièÿ ìèêðîêî ìïuþòaðîâ. Îi ðàçðàaîòài ôèð ìîe “Áîðëàia” êàê aèàëaêò ñòàiaàðòiîãî ÿçûêà Результаты поискаàñêàëu, iî aëàãîaàðÿ ñâîae ïîïoëÿðiîñòè ñà ì ñòàë ñòàiaàðòî ì ÿçûêà ïðîãðà ì ìèðîâàièÿ 8- è 16-ðàçðÿaiûõ ìèêðîêî ìïuþòaðîâ.

Ê âàæiaeøè ì aîñòîèiñòâà ì ÿçûêà Òoðaî Результаты поискаàñêàëu îòiîñÿòñÿ iaaîëuøîe ðàç ìað êî ìïèëÿòîðà, âûñîêàÿ ñòaïaiu ñîîòâaòñòâèÿ ñòàiaàðòiî ìo Результаты поискаàñêàëþ, î÷aiu aûñòðàÿ êî ìïèëÿoèÿ ïðîãðà ì ì, îaúaaèiaièa êî ìïèëÿòîðà ñ èiòaðàêòèâiû ì ýêðàiiû ì ðaaàêòîðî ì, ïðaaoïðaæaaièa îa îøèaêàõ ià oðîâia èñõîaiîe ïðîãðà ì ìû, îaøèðiàÿ aèaëèîòaêà ïîaïðîãðà ì ì è ïîëaçiûa ðàñøèðaièÿ, oïðîùàþùèa ñèñòa ìiîa ïðîãðà ì ìèðîâàièa.

Ââaaaièa

Îaiîe èç îñiîâiûõ ïðîaëa ì, ñ êîòîðîe ñòàëêèâàþòñÿ â ïðîoañña ïðîãðà ì ìèðîâàièÿ, ÿâëÿaòñÿ iàïèñàièa ïðîãðà ì ìû, ia ñîaaðæàùae îøèaîê. Îøèaêo iàèaîëaa ïîëiî ìîæiî îïðaaaëèòu êàê ðàñõîæaaièa ïîâaaaièÿ ïðîãðà ì ìû ñ îæèaàièÿ ìè ïîëuçîâàòaëÿ. Ñþaà âõîaèò êàê iañîîòâaòñòâèa ðaçoëuòàòîâ èñõîaiû ì aàiiû ì, òàê è aðoãèa, ïîðîe aîëaa îïàñiûa ýôôaêòû: çàoèêëèâàièa, àâàðèeiàÿ îñòàiîâêà ïðîãðà ì ì è ò.ï.

Íàèaîëaa ÿâiî iàaëþaàa ìû ìè èñòîðè÷añêè ìè òaiaaioèÿ ìè â ïðîãðà ì ìèðîâàièè ÿâëÿþòñÿ iaïðaðûâiûe ðîñò ïîëuçîâàòaëuñêèõ òðaaîâàièe, ëàâèiîîaðàçiîa oñëîæiaièa ôoiêoèîiàëuiîñòè ïðîãðà ì ìû è, êàê ñëaañòâèa, – oñëîæiaièa a¸ ðàçðàaîòêè. ñâÿçè ñ oâaëè÷aièa ì òðoaî¸ ìêîñòè ïðîãðà ìiûõ ñðaañòâ âîçièêëà iaîaõîaè ìîñòu âûðàaîòêè èiòaëëaêòoàëuiûõ èiñòðo ìaiòîâ, ïîçâîëÿþùèõ ðàçðàaîò÷èêà ì ñïðàâëÿòuñÿ ñ âîçðîñøae ñëîæiîñòuþ ñâîaãî òðoaà.

 iàñòîÿùèe ìî ìaiò ìîæiî oòâaðæaàòu, ÷òî ïðàêòè÷añêè êàæaàÿ ïðîãðà ì ìà ñîñòàâëÿaòñÿ ñ ïðè ìaiaièa ì òîe èëè èiîe òaõiîëîãèè ïðîãðà ì ìèðîâàièÿ.

“ ñâÿçè ñ òa ì,÷òî çà ïîñëaaièa aañÿòu èëè ïÿòuiàaoàòu ëaò ïðîèçâîaèòaëuiîñòu âû÷èñëèòaëuiûõ ìàøèi oâaëè÷èëàñu â òûñÿ÷è ðàç, ïîëuçîâàòaëè ñòàëè ãîðàçaî aîëaa aañoaða ìîiiû ìè ïðè âûaîða ïðîaëa ì, êîòîðûa îiè ñ÷èòàþò “òaõiè÷añêè ðàçðaøè ìû ìè”. Результаты поискаîëuçîâàòaëè õîòÿò, ÷òîaû ðàç ìaðû, ñëîæiîñòu è èçîùð¸iiîñòu ïðîãðà ì ì oâaëè÷èâàëàñu èñêëþ÷èòaëuiî aûñòðû ìè òa ìïà ìè, è â ïîñëaaièa ãîaû ñòàëî î÷aâèaiû ì, ÷òî â oaëî ì iàøè ïðîãðà ì ìèñòñêèa âîç ìîæiîñòè ia ïîñïaâàþò çà ýòè ìè iao ìaðaiiû ìè àïïaòèòà ìè”.

Результаты поискаî ìaða òîãî, êàê ìîùu êî ìïuþòaðîâ ðîñëà, à îaëàñòu ïðè ìaiaièÿ âñ¸ ðàñøèðÿëàñu, oâaëè÷èâàëèñu ia òîëuêî ðàç ìaðû, è ñëîæiîñòu ïðîãðà ì ì, iî è êîëè÷añòâî îøèaîê â ièõ.

Ãëàâiîe çàaà÷ae ñîâða ìaiiîãî ïðîãðà ì ìèñòà ïðè iàïèñàièè ïðîãðà ì ìû ÿâëÿaòñÿ ia ïîaâaãàièa a¸ aañêîia÷iû ì òañòèðîâàièÿ ì, à òùàòaëuiûe, ïîëiûe àiàëèç èñõîaiîãî òaêñòà ïðîãðà ì ìû, à òàêæa îòëàaêà ïðîãðà ì ìû ñ ïî ìîùuþ aîïîëièòaëuiûõ ïðîãðà ìiûõ ñðaañòâ.

Çàaàièa ià ïðîaêòèðîâàièa

Ðàçðàaîòàòu àëãîðèò ì èãðû “ÀÐÊÀÍÎÈÄ”, oaëu êîòîðîe çàêëþ÷àaòñÿ â iàaîða êàê ìîæiî aîëuøaãî êîëè÷añòâà î÷êîâ, êîòîðûa oâaëè÷èâàþòñÿ ïðè âûaèâàièè î÷aðaaiîãî êoaèêà.

Результаты поискаðè âûaèâàièè âñaõ êoaèêîâ òaêoùaãî oðîâiÿ îñoùañòâëÿaòñÿ ïaðaõîa ià ñëaaoþùèe oðîâaiu, êîëè÷añòâî êîòîðûõ – aañÿòu.

 êîioa èãðû â çàâèñè ìîñòè îò êîëè÷añòâà iàaðàiiûõ î÷êîâ, ââaa¸iiîa ïî çàïðîño ïðîãðà ì ìû è ìÿ èãðîêà aîëæiî aûòu çàiañaiî â aañÿòêo ëo÷øèõ è çàïèñàiî â ôàeë.

Íàa ðà ìêîe, â òa÷aièa èãðû aîëæiû îòîaðàæàòuñÿ:

1) ¹ òaêoùaãî ýòàïà;

2) êîëè÷añòâî îñòàâøèõñÿ æèçiae, ïaðâîià÷àëuiî êîòîðûõ – 10;

1. êîëè÷añòâî îñòàâøèõñÿ êoaèêîâ;

2. êîëè÷añòâî iàaðàiiûõ î÷êîâ.

Результаты поискаðàâèëà ïîëuçîâàièÿ ïðîãðà ì ìîe:

1. çàïoñòèòu MARKBALL. EXE

2. âûaðàòu ÷a ì èãðàòu:

2a) ìûøu

2a) êëàâèàòoðà

3. âûaðàòu ñêîðîñòu øàðèêà

4. âûaðàòu ðàç ìað ïëàiêè

Èñïîëuçoa ìûa ñòðoêòoðû aàiiûõ:

Type t_kubik=0..640;

T_dx_dy=-1..1;

T_arr=array[1..494] of t_kubik;

Kol_kubik=0..247;

T_kubik – çià÷aièÿ âñaõ ïaða ìaiiûõ, èñïîëuçoa ìûõ â ïðîãðà ì ìa, çàaàiû â ýòèõ ïðaaaëàõ (è ia aîëaa);

T_dx_dy – çià÷aièa, êîòîðîa ïðèiè ìàaò êîýôôèoèaiò, îò êîòîðîãî çàâèñèò iàïðàâëaièa aâèæaièÿ ïî îñè ÎÕ èëè ÎÓ;

T_arr – çià÷aièÿ êîîðaèiàò, êîòîðûa ïðèiè ìàaò êoaèê, â ñîîòâaòñòâèè ñî ñâîè ì îòîaðàæaièa ì (èçîaðàæaièa ì) ià ýêðàia;

Kol_kubik – ìàêñè ìàëuiîa êîëè÷añòâî êoaèêîâ;

Èñïîëuçoa ìûa ìîaoëè:

Ñòàiaàðòiûa:

1. CRT;

2. GRAPH;

3. WINDOS – ìîaoëu òðaaoa ìûe ñêîiñòðoèðoa ìû ì ìîaoëa ì MYMOUSE;

4. STRINGS – ìîaoëu òðaaoa ìûe ñêîiñòðoèðoa ìû ì ìîaoëa ì MYMOUSE;

Ñêîiñòðoèðîâàiiûa:

1. MARKEL – îñiîâiûa èãðîâûa ïîaïðîãðà ì ìû;

2. MARK_ZAS – ñîaaðæèò èiñòðo ìaiòàðèe èiòaðôaeñà (çàñòàâêà, ïî ìîùu, ñ÷¸ò ëo÷øèõ èãðîêîâ â êîioa èãðû);

3. MYMOUSE – ðàaîòà ñ ìûøuþ

Ñïaoèôèêàoèÿ ïîaïðîãðà ì ì:

Ìîaoëu MARKEL

1. procedure livs(var liv:byte);

Íàçià÷aièa: ñ÷èòàaò îñòàâøèañÿ æèçiè, añëè ÷èñëî æèçiae aoaaò ðàâiî ioëþ, òî âûâîaèò ià ýêðài ìèãàþùoþ iàaïèñu: “YOU HAVE LOST”;

Âõîaiûa aàiiûa: liv – ÷èñëî æèçiae;

Âûõîaiûa aàiiûa: liv – îñòàâøèañÿ êîëè÷añòâî æèçiae;

2. procedure perehod_level(const numbering:byte);

Íàçià÷aièa: âûâîaèò ïî ñaðaaèia ýêðàià iàaïèñu, ñîîòâaòñòâoþùoþ ià÷àëo iîâîãî ýòàïà;

Âõîaiûa aàiiûa: numbering – iî ìað iîâîãî ýòàïà;

Âûõîaiûa aàiiûa: iaò;

3. procedure planka_sharik(koeff:byte);

Íàçià÷aièa: ðèñoaò ïëàiêo, ðàç ìaðî ì, îïðaaaë¸iiû ì îò çià÷aièÿ koeff, ïîñaðaaèia ýêðàià è øàðèê iàa iae;

Âõîaiûa aàiiûa: koeff – ÷èñëî îïðaaaëÿþùaa ðàç ìað ïëàiêè;

Âûõîaiûa aàiiûa: iaò;

4. procedure musik;

Íàçià÷aièa: âûaà¸ò çâoêîâîe ñèãiàë, ñîîòâaòñòâoþùèe êàêî ìo-ëèaî êàñàièþ øàðèêà î ÷òî ièaoau;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

5.procedure izchez_vv_niz(var dy:t_dx_dy;x, y,i:t_kubik;var a:t_arr;var kol_kub:kol_kubik);

Íàçià÷aièa: îïðaaaëÿaò êîñioëñÿ ëè øàðèê êoaèêà î âaðõiþþ èëè ièæiþþ ãðàiu;

Âõîaiûa aàiiûa:

2. dy – iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñè Y;

3. x, y – òaêoùèa êîîðaèiàòû oaiòðà øàðèêà;

4. i – çià÷aièa, îò êîòîðîãî çàâèñèò êàêèa êoaèêè ïðîâaðÿòu ià ñaèâàièa;

5. a – ìàññèâ êîîðaèiàò êoaèêîâ;

6. kol_kub – êîëè÷añòâî êoaèêîâ ià aàiiûe ìî ìaiò;

Âûõîaiûa aàiiûa:

7. dy – èç ìai¸iiîa iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñè Y;

8. a – èç ìai¸iiûe ìàññèâ êîîðaèiàò êoaèêîâ;

9. kol_kub – èç ìai¸iiîa êîëè÷añòâî êoaèêîâ;

6. procedure bok_bok(var dx:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik);

Íàçià÷aièa: îïðaaaëÿaò êîñioëñÿ ëè øàðèê êoaèêà î ëaâoþ èëè ïðàâoþ ãðàiu;

Âõîaiûa aàiiûa:

10. dx – iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñè X;

11. x, y – òaêoùèa êîîðaèiàòû oaiòðà øàðèêà;

12. a – ìàññèâ êîîðaèiàò êoaèêîâ;

13. kol_kub – êîëè÷añòâî êoaèêîâ ià aàiiûe ìî ìaiò;

Âûõîaiûa aàiiûa:

14. dx – èç ìai¸iiîa iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñè X;

15. a – èç ìai¸iiûe ìàññèâ êîîðaèiàò êoaèêîâ;

16. kol_kub – èç ìai¸iiîa êîëè÷añòâî êoaèêîâ;

7. procedure death;

Íàçià÷aièa: âûaà¸ò çâoêîâîe ñèãiàë, ñîîòâaòñòâoþùèe ïðîèãðûøo îaiîe æèçiè;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

8. procedure ugolki(var dx, dy:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik);

Íàçià÷aièa: îïðaaaëÿaò êîñioëñÿ ëè øàðèê êoaèêà îa oãëû;

Âõîaiûa aàiiûa:

17. dx, dy – iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñÿ ì X è Y;

18. x, y – òaêoùèa êîîðaèiàòû oaiòðà øàðèêà;

19. a – ìàññèâ êîîðaèiàò êoaèêîâ;

20. kol_kub – êîëè÷añòâî êoaèêîâ ià aàiiûe ìî ìaiò;

Âûõîaiûa aàiiûa:

21. dx, dy – èç ìai¸iiîa iàïðàâëaièa aâèæaièÿ øàðèêà ïî îñÿ ì X è Y;

22. a – èç ìai¸iiûe ìàññèâ êîîðaèiàò êoaèêîâ;

23. kol_kub – èç ìai¸iiîa êîëè÷añòâî êoaèêîâ;

9. procedure pausing(var pause:word);

Íàçià÷aièa: îïðaaaëÿaò ñêîðîñòu aâèæaièÿ øàðèêà ïî âûaîðo ñà ìè ì ïîëuçîâàòaëa ì, ñ iàãëÿaiû ì ãðàôè÷añêè ì èiòaðôaeñî ì;

Âõîaiûa aàiiûa:

Pause – ïðaaïîëàãàa ìàÿ ïàoçà;

Âûõîaiûa aàiiûa:

Pause – oæa îïðaaaë¸iiàÿ ïàoçà;

10. procedure zapis(const xs, ys:t_kubik; i:t_kubik;var a:t_arr);

Íàçià÷aièa: îïðaaaëÿaò ià êàêèa ìañòà â ìàññèâa çàïèñûâàòu êîîðaèiàòû êoaèêà;

Âõîaiûa aàiiûa:

1) xs, ys – êîîðaèiàòû øàðèêà, êîòîðûa è ioæiî çàïèñàòu â ìàññèâ;

24. i – ïaða ìaiiàÿ îò êîòîðîe çàâèñèò ñ êàêîãî iî ìaðà èñêàòu ïîaõîaÿùaa ìañòî aëÿ êîîðaèiàò êoaèêà;

25. a – ìàññèâ êîîðaèiàò êoaèêîâ;

Âûõîaiûa aàiiûa: iaò

11. procedure level(var a:t_arr;const numbering:byte;var kol_kub:kol_kubik);

Íàçià÷aièa: îòêðûâàaò ôàeë è ñ÷èòûâàÿ ñ iaãî êîîðaèiàòû êoaèêîâ, ðèñoaò èõ;

Âõîaiûa aàiiûa:

1. a – ìàññèâ êîîðaèiàò êoaèêîâ;

2. numbering – iî ìað îòêðûâàa ìîãî ýòàïà;

3. kol_kub – êîëè÷añòâî êoaèêîâ;

Âûõîaiûa aàiiûa:

1. a – ìàññèâ êîîðaèiàò êoaèêîâ;

2) kol_kub – êîëè÷añòâî iàðèñîâàiiûõ êoaèêîâ;

12. procedure left(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Íàçià÷aièa: aâèæaièa ïëàiêè âëaâî;

Âõîaiûa aàiiûa:

1) koeff – êîýôôèoèaiò, îò êîòîðîãî çàâèñèò ðàç ìað ïëàiêè;

2. x1_dv, x2_dv – êîîðaèiàòû ïëàiêè ïî îñè Õ;

Âûõîaiûa aàiiûa:

X1_dv, x2_dv – èç ìaièâøèañÿ êîîðaèiàòû ïëàiêè ïî îñè Õ;

13. procedure right(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Íàçià÷aièa: aâèæaièa ïëàiêè âïðàâî;

Âõîaiûa aàiiûa:

1) koeff – êîýôôèoèaiò, îò êîòîðîãî çàâèñèò ðàç ìað ïëàiêè;

3. x1_dv, x2_dv – êîîðaèiàòû ïëàiêè ïî îñè Õ;

Âûõîaiûa aàiiûa:

X1_dv, x2_dv – èç ìaièâøèañÿ êîîðaèiàòû ïëàiêè ïî îñè Õ;

14. procedure dviguna_keyboard(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Íàçià÷aièa: îæèaàièa iàæàòèÿ êëàâèøè aëÿ ià÷àëà iîâîãî ýòàïà, añëè ïîëuçîâàòaëu èãðàaò ià êëàâèàòoða;

Âõîaiûa aàiiûa:

1) koeff – êîýôôèoèaiò, îò êîòîðîãî çàâèñèò ðàç ìað ïëàiêè;

1. x, y – êîîðaèiàòû øàðèêà;

2. x1_dv, x2_dv – êîîðaèiàòû ïëàiêè ïî îñè Õ;

Âûõîaiûa aàiiûa:

3. x, y – êîîðaèiàòû øàðèêà;

4. x1_dv, x2_dv – èç ìaièâøèañÿ êîîðaèiàòû ïëàiêè ïî îñè Õ;

15. procedure dviguna_mouse(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Íàçià÷aièa: îæèaàièa iàæàòèÿ êiîïêè ìûøè aëÿ ià÷àëà iîâîãî ýòàïà, añëè ïîëuçîâàòaëu èãðàaò ìûøuþ;

Âõîaiûa aàiiûa:

1) koeff – êîýôôèoèaiò, îò êîòîðîãî çàâèñèò ðàç ìað ïëàiêè;

2) x, y – êîîðaèiàòû øàðèêà;

5. x1_dv, x2_dv – êîîðaèiàòû ïëàiêè ïî îñè Õ;

Âûõîaiûa aàiiûa:

1. x, y – êîîðaèiàòû øàðèêà;

2. x1_dv, x2_dv – èç ìaièâøèañÿ êîîðaèiàòû ïëàiêè ïî îñè Õ;

16. procedure zar_nar(var x, y:t_kubik;const dx, dy:t_dx_dy);

Íàçià÷aièa: çàêðàñêà oæa iàðèñîâàiiîãî øàðèêà è iàðèñîâàièa iîâîãî øàðèêà ñ èç ìai¸iiû ìè êîîðaèiàòà ìè;

Âõîaiûa aàiiûa:

1) x, y – êîîðaèiàòû øàðèêà;

2) dx, dy – îò çià÷aièÿ ýòèõ ïaða ìaiiûõ çàâèñèò aâèæaièa øàðèêà â òo èëè èioþ ñòîðîio;

Âûõîaiûa aàiiûa:

X, y – êîîðaèiàòû øàðèêà;

17. function chem_play:boolean;

Íàçià÷aièa: îïðaaaëaièa ïîëuçîâàòaëa ì ÷a ì èãðàòu (êëàâèàòoðîe èëè ìûøuþ), ñ iàãëÿaiû ì ãðàôè÷añêè ì èiòaðôaeñî ì;

Âõîaiûa aàiiûa:

Íaò;

Âûõîaiûa aàiiûa:

True – èãðàa ì ìûøuþ;

False – èãðàa ì ià êëàâèàòoða;

18. procedure razmer_planki(var koeff:byte);

Íàçià÷aièa: îïðaaaëaièa ïîëuçîâàòaëa ì ðàç ìaðà ïëàiêè;

Âõîaiûa aàiiûa:

Koeff – êîýôôèoèaiò, îïðaaaëÿþùèe ðàç ìað ïëàiêè;

Âûõîaiûa aàiiûa:

Koeff – êîýôôèoèaiò, îïðaaaëÿþùèe ðàç ìað ïëàiêè; ãðàa ì ìûøuþ;

19. procedure naverhu_liv(liv:byte);

Íàçià÷aièa: îòîaðàæaièa iàa ðà ìêîe â òa÷aièa èãðû êîëè÷añòâà îñòàâøèõñÿ æèçiae;

Âõîaiûa aàiiûa:

Liv – ÷èñëî æèçiae;

Âûõîaiûa aàiiûa:

iaò;

20.procedure naverhu_number(numbering:byte);

Íàçià÷aièa: îòîaðàæaièa iàa ðà ìêîe â òa÷aièa èãðû iî ìaðà òaêoùaãî oðîâiÿ;

Âõîaiûa aàiiûa:

Numbering – iî ìað oðîâiÿ;

Âûõîaiûa aàiiûa:

iaò;

21. procedure naverhu_kubiki(kol_kub:byte);

Íàçià÷aièa: îòîaðàæaièa iàa ðà ìêîe â òa÷aièa èãðû êîëè÷añòâà îñòàâøèõñÿ êoaèêîâ;

Âõîaiûa aàiiûa:

Kol_kub – ÷èñëî îñòàâøèõñÿ êoaèêîâ;

Âûõîaiûa aàiiûa:

iaò;

Ìîaoëu MARK_ZAS

1. procedure zastavka(s2:string);

Íàçià÷aièa: â ià÷àëa èãðû èñïîëuçoaòñÿ â êà÷añòâa çàñòàâêè ñ ìèãàþùae aîëuøîe iàaïèñuþ “MARKBALL” è ièæa ìèãàþùae iàaïèñuþ “Click to start” ,òàêæa èñïîëuçoaòñÿ ïðè ïîòaða âñaõ æèçiae , iî ïðè ýòî ì ièæiÿÿ iàaïèñu aoaaò “You have lost” , à ïðè ïðîõîæaaièè âñaõ ýòàïîâ ièæiÿÿ iàaïèñu aoaaò “The end of game”;

Âõîaiûa aàiiûa:

S2 – ièæiÿÿ ìèãàþùàÿ iàaïèñu;

Âûõîaiûa aàiiûa:

iaò;

2. procedure text_na_ekran;

Íàçià÷aièa: èñïîëuçoaòñÿ êàê ñïðàâêà ïîêà èãðà aù¸ ia ià÷àëàñu ïðè iàæàòèè êëàâèøè “F1”;

Âõîaiûa aàiiûa:

iaò;

Âûõîaiûa aàiiûa:

iaò;

3. procedure ochki(score:word);

Íàçià÷aièa: â êîioa èãðû ñ÷èòàaò â ñîîòâaòñòâèè ñ iàaðàiiû ìè î÷êà ìè: çàe ì¸ò ëè aàiiûe èãðîê, êîòîðûe ââ¸ë ïî çàïðîño ïðîãðà ì ìû ñâî¸ è ìÿ, êàêîa-ièaoau ìañòî ñðaaè ïðaañòàâëaiiûõ aañÿòè ìañò; añëè êîëè÷añòâî iàaðàiiûõ î÷êîâ ïîçâîëÿaò èãðîêo çàiÿòu iaêîòîðîa ìañòî, òî ïðîãðà ì ìà âûâîaèò ià ýêðài òàaëèoo ëèaaðîâ, âêëþ÷àþùoþ â ñaaÿ è ìÿ aàiiîãî èãðîêà, â ïðîòèâiî ì ñëo÷àa ià ýêðài âñ¸ æa aoaaò âûâaaaià òàaëèoà ëèaaðîâ, iî è ìaiè aàiiîãî èãðîêà ñîaaðæàòuñÿ òà ì ia aoaaò;

Âõîaiûa aàiiûa:

Score – êîëè÷añòâî iàaðàiiûõ â òa÷aièè èãðû î÷êîâ;

Âûõîaiûa aàiiûa:

iaò;

Îñiîâiàÿ ïðîãðà ì ìà

1. Procedure initgr;

Íàçià÷aièa: èièoèàëèçèðoaò ãðàôèêo â ðaæè ìa vgahi;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

2. Procedure vostanovka_colors;

Íàçià÷aièa: âîññòàiàâëèâàaò oâaòà ñî ñòàiaàðòiû ìè îòòaiêà ìè;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

Òaêñò ïðîãðà ì ìû:

Program mark_ball;

Uses graph, crt, mymouse, markel, mark_zas;

Procedure initgr;

Var grdriver, grmode:integer;

Begin

Grdriver:=vga;

Grmode:=vgahi;

Initgraph(grdriver, grmode,”);

If GraphResult <> grOk then halt;

End;

Procedure vostanovka_colors;

Begin

Setrgbpalette(black,0,0,0);

Setrgbpalette(blue,0,0,40);

Setrgbpalette(green,0,40,0);

Setrgbpalette(cyan,0,40,40);

Setrgbpalette(red,40,7,7);

Setrgbpalette(magenta,40,0,40);

Setrgbpalette(brown,40,30,0);

Setrgbpalette(lightgray,49,49,49);

Setrgbpalette(darkgray,26,26,26);

Setrgbpalette(lightblue,0,0,63);

Setrgbpalette(lightgreen,9,63,9);

Setrgbpalette(lightcyan,0,63,63);

Setrgbpalette(lightred,63,10,10);

Setrgbpalette(lightmagenta,44,0,63);

Setrgbpalette(yellow,63,63,18);

Setrgbpalette(white,63,63,63);

End;

Var y_planka, xmax,

X1_dv, x2_dv, x,y, i:t_kubik;

X_get, y_get, x_get_pred:word;

Dx, dy:t_dx_dy;

A:t_arr;

Numbering, liv:byte;

Kol_kub:kol_kubik;

Lb, rb, tb, dviguna:boolean;

Buttoncount, errorcode, koeff:byte;

Pause:word;

Score:integer;

S2:string;

Begin

S2:=’Click to start’;

Initgr;

Zastavka(s2);

Vostanovka_colors;

Setlinestyle(0,0,1);

Randomize;

Cleardevice;

Xmax:=getmaxx-radius-1;

Y:=getmaxy-shir-radius-1;

Y_planka:=getmaxy-shir-radius-1;

Liv:=10;

Score:=-10;

Dviguna:=chem_play;

Pausing(pause);

Razmer_planki(koeff);

For numbering:=1 to 10 do

Begin

Perehod_level(numbering);

Cleardevice;

Planka_sharik(koeff);

Level(a, numbering, kol_kub);

Naverhu_number(numbering);

Naverhu_liv(liv);

Naverhu_kubiki(kol_kub, score);

Dx:=-1;

Dy:=-1;

{à ª }

Setcolor(random(14)+1);

Rectangle(0,21,getmaxx, getmaxy);

If dviguna then dviguna_mouse(koeff, x,x1_dv, x2_dv, y)

Else dviguna_keyboard(koeff, x,x1_dv, x2_dv, y);

While kol_kub>0 do

Begin

Zar_nar(x, y,dx, dy);

Delay(pause);

If (y=radius+1+21) or

((x1_dv

Begin dy:=-dy; musik; end else

If (x=xmax) or (x=radius+1) then

Begin dx:=-dx; musik; end else

If y=y_planka then

Begin

Setcolor(0);

Circle(x, y,radius);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Dy:=-1;

Death;

Livs(liv, score);

Case dviguna of

True:dviguna_mouse(koeff, x,x1_dv, x2_dv, y);

False:dviguna_keyboard(koeff, x,x1_dv, x2_dv, y);

End;

End;

Case x of

1..49: begin i:=37;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

50..99: begin i:=75;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

100..148:begin i:=113;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

149..197:begin i:=151;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

198..246:begin i:=189;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

247..295:begin i:=227;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

296..344:begin i:=265;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

345..393:begin i:=303;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

394..442:begin i:=341;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

443..491:begin i:=379;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

492..540:begin i:=417;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

541..588:begin i:=455;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

589..637:begin i:=493;izchez_vv_niz(dy, x,y, i,a, kol_kub, score); end;

End;

Bok_bok(dx, x,y, a,kol_kub, score);

Ugolki(dx, dy, x,y, a,kol_kub, score);

Case dviguna of

False:

If keypressed then

Case readkey of

#75: left(koeff, x1_dv, x2_dv);

#77: right(koeff, x1_dv, x2_dv);

#27:begin closegraph; halt; end;

End;

True:

Begin

Getmousexy(x_get, y_get, lb, rb, tb);

If x_get_pred<>x_get then begin

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

X1_dv:=x_get;

X2_dv:=x1_dv+koeff*shir;

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

X_get_pred:=x_get; end;

If rb then begin closegraph;halt;end;

End;

End;

End;

Dec(score,10);

End;

Inc(score,10);

Ochki(score);

S2:=’The end of game’;

Zastavka(s2);

Closegraph;

End.

Òaêñò ñêîiñòðoèðoa ìûõ ìîaoëae:

Unit markel;

Interface

Uses crt, graph, mymouse, mark_zas;

Var sverhu:string;

Liv, numbering:byte;

Const radius=7;

Shir=15;

Y1_dv=479-1;

Y2_dv=479-shir;

Type t_kubik=-10..640;

T_dx_dy=-1..1;

T_arr=array[1..494] of t_kubik;

Kol_kubik=0..247;

Procedure livs(var liv:byte;score:integer);

Procedure perehod_level(const numbering:byte);

Procedure planka_sharik(koeff:byte);

Procedure musik;

Procedure izchez_vv_niz(var dy:t_dx_dy;x, y,i:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Procedure bok_bok(var dx:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Procedure death;

Procedure ugolki(var dx, dy:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Procedure pausing(var pause:word);

Procedure zapis(const xs, ys:t_kubik;i:t_kubik;var a:t_arr);

Procedure level(var a:t_arr;const numbering:byte;var kol_kub:kol_kubik);

Procedure left(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Procedure right(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Procedure dviguna_keyboard(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Procedure dviguna_mouse(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Procedure zar_nar(var x, y:t_kubik;const dx, dy:t_dx_dy);

Function chem_play:boolean;

Procedure razmer_planki(var koeff:byte);

Procedure naverhu_liv(liv:byte);

Procedure naverhu_number(numbering:byte);

Procedure naverhu_kubiki(kol_kub:byte;var score:integer);

Procedure naverhu_score(score:integer);

Implementation

Function chem_play:boolean;

Var mask:boolean;

Greenvalue, bluevalue:0..64;

I, j:-1..1;

Begin

Setcolor(blue);

Settextstyle(4{GothicFont},horizdir,5);

Settextjustify(1,1);

Outtextxy(round(getmaxx / 3.3), round(getmaxy / 2.3),’Mouse’);

Setcolor(green);

Outtextxy(round(getmaxx / 1.5), round(getmaxy / 2.3),’Keyboard’);

I:=1;

J:=1;

Greenvalue:=0;

Bluevalue:=0;

While true do

Begin

Repeat

Case mask of

True:begin

SetRGBpalette(blue,0,0,bluevalue);

Inc(bluevalue, i);

If (bluevalue = 63) or (bluevalue = 0) then

I:=-i;

End;

False:begin

SetRGBpalette(green,0,greenvalue,0);

Inc(greenvalue, j);

If (greenvalue = 63) or (greenvalue = 0) then

J:=-j;

End;

End;

Until keypressed;

Case readkey of

#75: mask:=true;

#77: mask:=false;

#13: begin chem_play:=mask; delay(5000); cleardevice; exit; end;

#27: begin closegraph; halt; end;

End;

End;

End;

Procedure ugolki(var dx, dy:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Procedure izchez(var dx, dy:t_dx_dy;var a:t_arr;var kol_kub:kol_kubik;i:word);

Begin

Setcolor(0);

Setfillstyle(1,0);

Bar3d(a[i],a[i+1],a[i]+48,a[i+1]-20,0,false);

Musik;

A[i]:=0;

A[i+1]:=0;

Dx:=-dx;

Dy:=-dy;

Dec(kol_kub);

Musik;

Naverhu_kubiki(kol_kub, score);

Exit;

End;

Var i:1..496;

Begin

I:=1;

While i<=493 do

Begin

If x-radius+1=a[i]+48 then

If (y-radius+1=a[i+1])or((y-radius+1a[i+1]-20))

Or(y+radius-1=a[i+1]-20)or((y+radius-1a[i+1]-20))

Then izchez(dx, dy, a,kol_kub, i);

If x+radius-1=a[i] then

If (y+radius-1=a[i+1]-20)or((y+radius-1a[i+1]-20))

Or(y-radius+1=a[i+1])or((y-radius+1a[i+1]-20))

Then izchez(dx, dy, a,kol_kub, i);

If y-radius+1=a[i+1] then

If (x-radius+1=a[i]+48)or((x-radius+1>a[i])and(x-radius+1<a[i]+48))

Or(x+radius-1=a[i])or((x+radius-1>a[i])and(x+radius-1<a[i]+48))

Then izchez(dx, dy, a,kol_kub, i);

If y+radius-1=a[i+1]-20 then

If (x+radius-1=a[i])or((x+radius-1>a[i])and(x+radius-1<a[i]+48))

Or(x-radius+1=a[i]+48)or((x-radius+1>a[i])and(x-radius+1<a[i]+48))

Then izchez(dx, dy, a,kol_kub, i);

Inc(i,2);

End;

End;

Procedure pausing(var pause:word);

Var xmax, y_planka, x,y:t_kubik;

Dx, dy:-1..1;

S:string;

Redvalue, bluevalue:0..63;

I:-1..1;

Begin

Setcolor(lightgray);

S:=’Adjust speed of a ball’;{‘îòðaãoëèðoeòa ñêîðîñòu øàðèêà’}

Settextstyle(4{GothicFont},horizdir,5);

Settextjustify(1,1);

Outtextxy(getmaxx div 2, getmaxy div 2,s);

I:=1;

Redvalue:=0;

Bluevalue:=0;

Repeat

Repeat

SetRGBpalette(lightgray, redvalue,0,bluevalue);

Inc(bluevalue, i);

Inc(redvalue, i);

Until keypressed or (bluevalue=63) or (bluevalue=0);

I:=-i;

Until keypressed;

Cleardevice;

{ðà ìêà}

Setcolor(random(14)+1);

Rectangle(0,0,getmaxx, getmaxy);

Xmax:=getmaxx-radius-1;

Y_planka:=getmaxy-shir-radius-1;

{ïëàiêà ià âañu ièç}

Setcolor(13);

Setfillstyle(6,13);

Bar3d(1,getmaxy-1,getmaxx, getmaxy-shir,0,false);

{øàðèê iàa ïëàiêîe}

X:=getmaxx div 2;

Y:=getmaxy-shir-radius-1;

Setcolor(10);

Circle(x, y,radius);

Dx:=1;

Dy:=-1;

Pause:=6;

Repeat

While not(keypressed) do

Begin

Zar_nar(x, y,dx, dy);

Delay(pause);

If y=radius+1 then

Begin dy:=-dy; musik; end else

If x=xmax then

Begin dx:=-dx; musik; end else

If y=y_planka then

Begin dy:=-dy; musik; end else

If x=radius+1 then

Begin dx:=-dx; musik; end;

End;

Case readkey of

#45{‘-‘}:if pause

#42{‘*’}:if pause >2 then dec(pause);

#13:begin cleardevice; exit; end;

End;

Until false;

End;

Procedure razmer_planki(var koeff:byte);

Var s:string;

X1,y1,x2,y2:integer;

I:-1..1;

Redvalue, bluevalue:0..63;

Begin

Setcolor(red);

S:=’Adjust the size of a rod'{‘îòðaãoëèðoeòa ðàç ìað ïëàiêè’};

Settextstyle(4{GothicFont},horizdir,5);

Settextjustify(1,1);

Outtextxy(getmaxx div 2, getmaxy div 2, s);

I:=1;

Redvalue:=0;

Bluevalue:=0;

Repeat

Repeat

SetRGBpalette(red, redvalue, bluevalue,0);

Inc(bluevalue, i);

Inc(redvalue, i);

Until keypressed or (redvalue=0) or (redvalue=63);

I:=-i;

Until keypressed;

Cleardevice;

{ðà ìêà}

Setcolor(random(14)+1);

Rectangle(0,0,getmaxx, getmaxy);

{ïëàiêà ïîñaðaaèia}

Setcolor(13);

Setfillstyle(6,13);

Koeff:=4;

X1:=round(getmaxx/2-(koeff/2)*shir-1);

Y1:=getmaxy-1;

X2:=round(getmaxx/2+(koeff/2)*shir);

Y2:=getmaxy-shir;

Bar3d(x1,y1,x2,y2,0,false);

Repeat

If keypressed then

Case readkey of

#42{‘*’}:if koeff

Begin

Inc(koeff);

X1:=round(getmaxx/2-(koeff/2)*shir-1);

Y1:=getmaxy-1;

X2:=round(getmaxx/2+(koeff/2)*shir);

Y2:=getmaxy-shir;

Bar3d(x1,y1,x2,y2,0,false);

End;

#45{-}:if koeff>2 then

Begin

Setcolor(0);

Setfillstyle(0,0);

X1:=round(getmaxx/2-(koeff/2)*shir-1);

Y1:=getmaxy-1;

X2:=round(getmaxx/2+(koeff/2)*shir);

Y2:=getmaxy-shir;

Bar3d(x1,y1,x2,y2,0,false);

Dec(koeff);

Setcolor(13);

Setfillstyle(6,13);

X1:=round(getmaxx/2-(koeff/2)*shir-1);

Y1:=getmaxy-1;

X2:=round(getmaxx/2+(koeff/2)*shir);

Y2:=getmaxy-shir;

Bar3d(x1,y1,x2,y2,0,false);

End;

#13:exit;

End;

Until false;

End;

Procedure livs(var liv:byte;score:integer);

Var s2:string;

Begin

Dec(liv);

Naverhu_liv(liv);

If liv=0 then

Begin

Ochki(score);

S2:=’You have lost!’;

Zastavka(s2);

Closegraph;

Halt;

End;

End;

Procedure perehod_level(const numbering:byte);

Var i, j:30..330;

S:string;

Begin

Str(numbering, s);

S:=’level ‘+s;

Cleardevice;

Setcolor(14);

Settextstyle(4{GothicFont},horizdir,5);

Settextjustify(1,1);

Outtextxy(getmaxx div 2, getmaxy div 2, s);

I:=30;

J:=280;

{while (i<>330) and (j<>30) do

Begin

Sound(i);

Delay(100);

Sound(j);

Delay(100);

Inc(i);

Dec(j);

End;

Nosound;}

Delay(5000);

End;

Procedure planka_sharik(koeff:byte);

Var x1,y1,x2,y2,x, y:integer;

Begin

{ïëàiêà ïîñaðaaèia}

Setcolor(13);

Setfillstyle(6,13);

X1:=round(getmaxx/2-(koeff/2)*shir-1);

Y1:=getmaxy-1;

X2:=round(getmaxx/2+(koeff/2)*shir);

Y2:=getmaxy-shir;

Bar3d(x1,y1,x2,y2,0,false);

{øàðèê iàa ïëàiêîe}

X:=getmaxx div 2;

Y:=getmaxy-shir-radius-1;

Setcolor(10);

Circle(x, y,radius);

End;

Procedure musik;

Begin

{sound(460);

Delay(130);

Nosound;}

End;

Procedure izchez_vv_niz(var dy:t_dx_dy;x, y,i:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Var p:-3..494;

Begin

P:=i-36;

While (i>=p) and not((y-radius+1=a[i+1]) or (y+radius-1=a[i+1]-20)) do

Dec(i,2);

If i

If (y-radius+1=a[i+1]) or (y+radius-1=a[i+1]-20) then

Begin

Setcolor(0);

Setfillstyle(1,0);

Bar3d(a[i],a[i+1],a[i]+48,a[i+1]-20,0,false);

Musik;

A[i]:=0;

A[i+1]:=0;

Dy:=-dy;

Dec(kol_kub);

Naverhu_kubiki(kol_kub, score);

End;

End;

Procedure bok_bok(var dx:t_dx_dy;x, y:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

Var i:1..496;

Begin

I:=1;

While i<=493 do

Begin

If ((x+radius-1=a[i]) and (ya[i+1]-20)) or

((x-radius+1=a[i]+48) and (ya[i+1]-20)) then

Begin

Setcolor(0);

Setfillstyle(1,0);

Bar3d(a[i],a[i+1],a[i]+48,a[i+1]-20,0,false);

Musik;

A[i]:=0;

A[i+1]:=0;

Dx:=-dx;

Dec(kol_kub);

Musik;

Naverhu_kubiki(kol_kub, score);

Exit;

End;

Inc(i,2);

End;

End;

Procedure death;

Var i:30..800;

Begin

I:=800;

{while i<>30 do

Begin

Sound(i);

Delay(10);

Dec(i);

End;

Nosound;}

End;

Procedure zapis(const xs, ys:t_kubik;i:t_kubik;var a:t_arr);

Begin

While a[i]<>0 do

Inc(i,2);

A[i]:=xs;

A[i+1]:=ys;

End;

Procedure level(var a:t_arr;const numbering:byte;var kol_kub:kol_kubik);

Var xs, ys, i:t_kubik;

F:text;

Color, pattern:byte;

Number:string;

Begin

For i:=1 to 494 do

A[i]:=0;

Str(numbering, number);

Assign(f,’levels\level’+number+’.den’);

Reset(f);

While not eof(f) do

Begin

Readln(f, xs, ys);

Color:=random(14)+1;

Pattern:=random(11)+1;

Setcolor(color);

Setfillstyle(pattern, color);

Bar3d(xs, ys,48+xs, ys-20,0,false);

End;

Close(f);

Kol_kub:=0;

Reset(f);

While not eof(f) do

Begin

Readln(f, xs, ys);

If xs<>0 then inc(kol_kub);

Case xs of

1: begin i:=1; zapis(xs, ys, i,a); end;

50: begin i:=39; zapis(xs, ys, i,a); end;

99: begin i:=77; zapis(xs, ys, i,a); end;

148: begin i:=115; zapis(xs, ys, i,a); end;

197: begin i:=153; zapis(xs, ys, i,a); end;

246: begin i:=191; zapis(xs, ys, i,a); end;

295: begin i:=229; zapis(xs, ys, i,a); end;

344: begin i:=267; zapis(xs, ys, i,a); end;

393: begin i:=305; zapis(xs, ys, i,a); end;

442: begin i:=343; zapis(xs, ys, i,a); end;

491: begin i:=381; zapis(xs, ys, i,a); end;

540: begin i:=419; zapis(xs, ys, i,a); end;

589: begin i:=457; zapis(xs, ys, i,a); end;

End;

End;

Close(f);

End;

Procedure left(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Begin

If x1_dv-8 <= 0 then

Begin

Musik;

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

X1_dv:=1;

X2_dv:=koeff*shir;

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

End else

Begin

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

Dec(x1_dv,8);

Dec(x2_dv,8);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

End;

End;

Procedure right(const koeff:byte;var x1_dv, x2_dv:t_kubik);

Begin

If x2_dv+8 >= getmaxx then

Begin

Musik;

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

X2_dv:=getmaxx-1;

X1_dv:=x2_dv-koeff*shir;

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

End else

Begin

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

Inc(x1_dv,8);

Inc(x2_dv,8);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

End;

End;

Procedure dviguna_keyboard(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Begin

{Ðèñoa ì ïëàiêo ñ øàðèêî ì ïîñaðaaèia}

Planka_sharik(koeff);

{Íèæa — êîîðaèiàòû ïëàiêè è øàðèêà(òîëuêî-÷òî iàðèñîâàiiûõ)}

X1_dv:=round(getmaxx/2-(koeff/2)*shir-1);

X2_dv:=round(getmaxx/2+(koeff/2)*shir);

X:=getmaxx div 2;

Y:=getmaxy-shir-radius-1;

Repeat

Case readkey of

#75: if x > (koeff div 2)*shir then

Begin

Left(koeff, x1_dv, x2_dv);

Setcolor(0);

Circle(x, y,radius);

X:=round(x1_dv+shir*koeff/2);

Setcolor(10);

Circle(x, y,radius);

End;

#77: if x < getmaxx-(koeff/2)*shir then

Begin

Right(koeff, x1_dv, x2_dv);

Setcolor(0);

Circle(x, y,radius);

X:=round(x1_dv+shir*koeff/2);

Setcolor(10);

Circle(x, y,radius);

End;

‘ ‘: exit;

#27:begin closegraph; halt; end;

End;

Until false;

End;

Procedure dviguna_mouse(const koeff:byte;var x, x1_dv, x2_dv:t_kubik;var y:t_kubik);

Var x_get, y_get:word;

X_get_pred:word;

Lb, rb, tb:boolean;

Begin

{Ðèñoa ì ïëàiêo ñ øàðèêî ì ïîñaðaaèia}

Planka_sharik(koeff);

{oñòàiàâëèâàaò îãðàiè÷aièa ïaða ìaùaièÿ êoðñîðà ìûøè ïî âaðòèêàëè}

SetYrange(5,5);

{oñòàiàâëèâàaò îãðàiè÷aièa ïaða ìaùaièÿ êoðñîðà ìûøè ïî ãîðèçîiòàëè}

SetXrange(1,getmaxx-koeff*shir-1);

{Íèæa — êîîðaèiàòû ïëàiêè è øàðèêà(òîëuêî-÷òî iàðèñîâàiiûõ)}

X1_dv:=round(getmaxx/2-(koeff/2)*shir-1);

X2_dv:=round(getmaxx/2+(koeff/2)*shir);

Setmousexy(x1_dv,0);

X:=getmaxx div 2;

Y:=getmaxy-shir-radius-1;

Repeat

Getmousexy(x_get, y_get, lb, rb, tb);

If x_get_pred<>x_get then

Begin

Setcolor(0);

Setfillstyle(0,0);

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

Setfillstyle(6,13);

Setcolor(13);

X1_dv:=x_get;

X2_dv:=x1_dv+koeff*shir;

Bar3d(x1_dv, y1_dv, x2_dv, y2_dv,0,false);

X_get_pred:=x_get;

Setcolor(0);

Circle(x, y,radius);

Setcolor(10);

X:=x_get+round(koeff/2)*shir;

Circle(x, y,radius);

End;

Until lb;

End;

Procedure zar_nar(var x, y:t_kubik;const dx, dy:t_dx_dy);

Begin

Setcolor(0);

Circle(x, y,radius);

Inc(x, dx);

Inc(y, dy);

Setcolor(10);

Circle(x, y,radius);

End;

Procedure naverhu_number(numbering:byte);

Var s:string;

Begin

Settextstyle(4{GothicFont},horizdir,3);

Settextjustify(centertext, centertext);

Setfillstyle(1,black);

Bar(0,0,120,19);

Setcolor(lightgreen);

Str(numbering, s);

S:=’Level ‘+s;

Outtextxy(60,5,s);

End;

Procedure naverhu_liv(liv:byte);

Var s:string;

Begin

Settextstyle(4{GothicFont},horizdir,3);

Settextjustify(centertext, centertext);

Setfillstyle(1,black);

Bar(140,0,250,19);

Setcolor(lightgreen);

Str(liv, s);

S:=’Lifes ‘+s;

Outtextxy(195,5,s);

End;

Procedure naverhu_kubiki(kol_kub:byte;var score:integer);

Var s:string;

Begin

Settextstyle(4{GothicFont},horizdir,3);

Settextjustify(centertext, centertext);

Setfillstyle(1,black);

Bar(270,0,420,19);

Setcolor(lightgreen);

Str(kol_kub, s);

S:=’Kubikov ‘+s;

Outtextxy(345,5,s);

Inc(score,10);

Naverhu_score(score);

End;

Procedure naverhu_score(score:integer);

Var s:string;

Begin

Settextstyle(4{GothicFont},horizdir,3);

Settextjustify(centertext, centertext);

Setfillstyle(1,black);

Bar(440,0,630,19);

Setcolor(lightgreen);

Str(score, s);

S:=’Score ‘+s;

Outtextxy(535,5,s);

End;

End.

Unit mark_zas;

Interface

Uses crt, graph, mymouse;

Type t_mas=array [1..11] of word;

Procedure zastavka(s2:string);

Procedure text_na_ekran;

Procedure ochki(score:word);

Implementation

Procedure text_na_ekran;

Var f:text;

A:char;

Begin

Assign(f,’pravila. txt’);

Reset(f);

Textmode(1);

Textbackground(3);

Textcolor(0);

Clrscr;

While not eof(f) do

Begin

While not(eof(f)) do

Begin

Read(f, a);

Write(a);

End;

Writeln;

End;

While not(keypressed) do

Case readkey of

#27:exit;

End;

Close(f);

End;

Procedure zastavka(s2:string);

Var redvalue:-2..63;

Greenvalue2:-2..63;

Lb, rb, tb:boolean;

Buttoncount, errorcode:byte;

X, y:word;

I:-1..1;

Begin

Initmouse(buttoncount, errorcode);

Cleardevice;

Setcolor(lightgreen);

Setlinestyle(0,2,3);

Rectangle(0,0,getmaxx, getmaxy);

Settextjustify(centertext, centertext);

Settextstyle(4{GothicFont},horizdir,9);

Setcolor(3);

Outtextxy(getmaxx div 2,round(getmaxy / 2.5),’Markball’);

Setcolor(1);

Settextstyle(7{TSCR. CHR},horizdir,2);

Settextjustify(lefttext, centertext);

If s2=’Click to start’ then

Outtextxy(10,10,’Press F1 for the help’);

Setcolor(2);

Settextstyle(7{TSCR. CHR},horizdir,3);

Outtextxy(getmaxx div 2,round(getmaxy / 1.3), s2);

I:=1;

Redvalue:=1;

Greenvalue2:=62;

Repeat

Repeat

Inc(redvalue, i);

SetRGBpalette(3,redvalue, redvalue,0);

GetmouseXY(x, y,lb, rb, tb);

Inc(greenvalue2,-i);

SetRGBpalette(2,0,greenvalue2,greenvalue2);

SetRGBpalette(1,Greenvalue2,0,0);

Until (redvalue=63) or (redvalue=0) or rb or lb or keypressed;

I:=-i;

If keypressed then

Case readkey of

#59{F1}:

Begin

Text_na_ekran;

SetGraphMode(vgahi);

Setcolor(lightgreen);

Setlinestyle(0,2,3);

Rectangle(0,0,getmaxx, getmaxy);

Settextjustify(centertext, centertext);

Settextstyle(4{GothicFont},horizdir,9);

Redvalue:=1;

Greenvalue2:=62;

Setcolor(3);

Outtextxy(getmaxx div 2,round(getmaxy / 2.5),’Markball’);

Setcolor(1);

Settextstyle(7{TSCR. CHR},horizdir,2);

Settextjustify(lefttext, centertext);

If s2=’Click to start’ then

Outtextxy(10,10,’Press F1 for the help’);

Setcolor(2);

Settextstyle(7{TSCR. CHR},horizdir,3);

Outtextxy(getmaxx div 2,round(getmaxy / 1.3), s2);

End;

#13:exit;

End;

Until rb or lb;

End;

Procedure ochki(score:word);

Var f:text;

S:string[15];

C:word;

Numb, mynumber:-5..20;

Player:t_mas;

Players_name:array [1..11] of string[15];

X, y:word;

I:char;

Myname:string[15];

Label ld;

Begin

Assign(f,’record. txt’);

Reset(f);

Readln(f);

Numb:=0;

While not eof(f) do

Begin

Readln(f, c);

Inc(numb);

Player[numb]:=c;

Readln(f);

End;

Close(f);

Reset(f);

Numb:=0;

While not eof(f) do

Begin

Readln(f, s);

Inc(numb);

Players_name[numb]:=s;

Readln(f);

End;

Close(f);

X:=getmaxx div 2-140;

Y:=35;

Bar3d(x, y,x+280,y+100,0,false);

Settextjustify(centertext, centertext);

Settextstyle(4{Gothic Font},horizdir,3);

Setcolor(lightcyan);

Outtextxy(x+140,y+10,’Enter your name’);

Myname:=”;

While true do

If keypressed then

Begin

I:=readkey;

Case i of

#13: goto ld;

Else begin

Outtextxy(x+20,y+40,i);

Inc(x,18);

Myname:=myname+i;

End;

End;

End;

Ld:

Mynumber:=0;

Numb:=1;

While (numb <= 10) and (score < player[numb]) do

Inc(numb);

If numb = 11 then

Begin

X:=getmaxx div 2-140;

Y:=35;

Bar3d(x, y,x+280,y+300,0,false);

Settextjustify(centertext, centertext);

Settextstyle(4{Gothic Font},horizdir,3);

Setcolor(lightcyan);

Outtextxy(x+140,y+10,’The best players’);

Settextjustify(lefttext, centertext);

Y:=75;

For numb:=1 to 10 do

Begin

Outtextxy(x+10,y, players_name[numb]);

Str(player[numb],s);

Outtextxy(x+190,y, s);

Inc(y,25);

Delay(1000);

End;

End

Else

Begin

Settextstyle(4{Gothic Font},horizdir,3);

Mynumber:=numb;

For c:=10 downto numb do

Begin

Player[c+1]:=player[c];

Players_name[c+1]:=players_name[c];

End;

Player[mynumber]:=score;

Players_name[mynumber]:=myname;

X:=getmaxx div 2-140;

Y:=35;

Bar3d(x, y,x+280,y+300,0,false);

Settextjustify(centertext, centertext);

Settextstyle(4{Gothic Font},horizdir,3);

Setcolor(lightcyan);

Outtextxy(x+140,y+10,’The best players’);

Y:=75;

Settextjustify(lefttext, centertext);

For numb:=1 to 10 do

Begin

Outtextxy(x+10,y, players_name[numb]);

Str(player[numb],s);

Outtextxy(x+190,y, s);

Inc(y,25);

Delay(1000);

End;

Rewrite(f);

For numb:=1 to 10 do

Begin

Writeln(f, players_name[numb]);

Writeln(f, player[numb]);

End;

Close(f);

End;

Readkey;

End;

End.

Äîïîëièòaëuiàÿ ïðîãðà ì ìà aëÿ ïîñòðîaièÿ ñîañòâaiiûõ oðîâiae :

Результаты поискаðàâèëà ïîëuçîâàièÿ ïðîãðà ì ìîe:

1. çàïoñòèòu MARKEDIT. EXE

2. iàæè ìàÿ ëaâoþ êiîïêo ìûøè ñòàâèòu(ðèñîâàòu) êoaèêè;

3. ïîñëa ïîñòðîaièÿ oðîâiÿ iàæàòu ïðàâoþ êiîïêo ìûøè;

4. ïîñëa ïîÿâëaièÿ ìaiþ iî ìaðîâ oðîâiae âûaðàòu iî ìað ñîõðàiÿa ìîãî oðîâiÿ (ôàeëà);

Ñïaoèôèêàoèè ïîaïðîãðà ì ì:

1. procedure text_na_ekran;

Íàçià÷aièa: èñïîëuçoaòñÿ êàê ñïðàâêà è âñaãaà ïîêàçûâàaòñÿ ïðè çàïoñêa;

Âõîaiûa aàiiûa:

iaò;

Âûõîaiûa aàiiûa:

iaò;

2. function netu:boolean;

Íàçià÷aièa: ïðè iàæàòèè ëaâîe êiîïêè ìûøè îïðaaaëÿaò, añòu ëè ià ýòî ì ìañòa oæa êoaèê èëè iaò;

Âõîaiûa aàiiûa:

iaò;

Âûõîaiûa aàiiûa:

True: ðèñoa ì êoaèê;

False: ià ýòî ì ìañòa oæa añòu êoaèê, çià÷èò ia ðèñoa ì;

3. procedure stroika;

Íàçià÷aièa: ðèñoaò êoaèê è çàïèñûâàaò aãî êîîðaèiàòû â ôàeë;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

4. procedure search_y;

Íàçià÷aièa: èùaò ïîaõîaÿùèa êîîðaèiàòû aëÿ ïîñòðîaièÿ êoaèêà;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

5. procedure build_level;

Íàçià÷aièa: ñòðîèò ýòàï, èñïîëuçoÿ âûøaîïèñàiiûa ïîaïðîãðà ì ìû;

Âõîaiûa aàiiûa: iaò;

Âûõîaiûa aàiiûa: iaò;

Òaêñò ïðîãðà ì ìû:

Program markedit;

Uses graph, crt, mymouse;

Type t_kubik=-10..640;

T_arr=array[1..494] of t_kubik;

Var x, y:word;

F, f_s:text;

A:t_arr;

I:1..494;

Procedure initgr;

Var grdriver, grmode:integer;

Begin

Grdriver:=vga;

Grmode:=vgahi;

Initgraph(grdriver, grmode,”);

If GraphResult <> grOk then halt;

End;

Procedure text_na_ekran;

Var f:text;

A:char;

Begin

Assign(f,’stroika. txt’);

Reset(f);

Textmode(1);

Textbackground(3);

Textcolor(0);

Clrscr;

While not eof(f) do

Begin

While not(eof(f)) do

Begin

Read(f, a);

Write(a);

End;

Writeln;

End;

While not(keypressed) do

Case readkey of

‘ ‘:exit;

End;

Close(f);

End;

Function netu:boolean;

Var k:1..494;

Begin

For k:=1 to 494 do

Begin

If a[k]=x then

If a[k+1]=y then

Begin netu:=false; exit; end;

End;

Netu:=true;

End;

Procedure stroika;

Var color:1..15;

Pattern:1..12;

Begin

If netu then

Begin

Writeln(f, x,’ ‘,y);

A[i]:=x;

A[i+1]:=y;

Inc(i,2);

Color:=random(14)+1;

Pattern:=random(11)+1;

Setcolor(color);

Setfillstyle(pattern, color);

Bar3d(x, y,48+x, y-20,0,false);

End;

End;

Procedure search_y;

Begin

Case y of

22..42: begin y:=42; stroika; end;

43..63: begin y:=63; stroika; end;

64..84: begin y:=84; stroika; end;

85..105: begin y:=105; stroika; end;

106..126:begin y:=126; stroika; end;

127..147:begin y:=147; stroika; end;

148..168:begin y:=168; stroika; end;

169..189:begin y:=189; stroika; end;

190..210:begin y:=210; stroika; end;

211..231:begin y:=231; stroika; end;

232..252:begin y:=252; stroika; end;

263..273:begin y:=273; stroika; end;

274..294:begin y:=294; stroika; end;

295..315:begin y:=315; stroika; end;

316..336:begin y:=336; stroika; end;

337..357:begin y:=357; stroika; end;

358..378:begin y:=378; stroika; end;

379..399:begin y:=399; stroika; end;

400..420:begin y:=420; stroika; end;

End;

End;

Procedure build_level;

Var buttoncount, errorcode:byte;

Lb, rb, tb:boolean;

X_pred:word;

S, s_l:string;

Number:0..10;

Spusk:1..500;

Code:integer;

Begin

Initmouse(buttoncount, errorcode);

Cleardevice;

{à ª }

Setcolor(random(14)+1);

Rectangle(0,21,getmaxx, getmaxy);

Setcolor(brown);

S:=’when finish — press the right button of the mouse’;

Settextstyle(7{GothicFont},horizdir,2);

Settextjustify(1,1);

Outtextxy(getmaxx div 2,5,s);

SetYrange(21,420);

SetXrange(1,637);

Assign(f,’level. den’);

Rewrite(f);

X:=10;y:=10;

SetmouseXY(x, y);

X_pred:=0;

Mouseon;

Repeat

GetmouseXY(x, y,lb, rb, tb);

If lb then begin

Mouseoff;

If x<>x_pred then

Case x of

1..49: begin x:=1; search_y; end;

50..98: begin x:=50; search_y; end;

99..147:begin x:=99; search_y; end;

148..196:begin x:=148; search_y; end;

197..245:begin x:=197; search_y; end;

246..294:begin x:=246; search_y; end;

295..343:begin x:=295; search_y; end;

344..392:begin x:=344; search_y; end;

393..441:begin x:=393; search_y; end;

442..490:begin x:=442; search_y; end;

491..539:begin x:=491; search_y; end;

540..588:begin x:=540; search_y; end;

589..637:begin x:=589; search_y; end;

End;

X_pred:=x;

Mouseon; end;

Until rb;

Setfillstyle(1,black);

Bar(4,getmaxy div 5-8,130,getmaxy div 5 +300+20);

Setcolor(yellow);

S:=’Save as: ‘;

Spusk:=getmaxy div 5;

Settextstyle(4{GothicFont},horizdir,4);

Settextjustify(lefttext, centertext);

Outtextxy(4,spusk, s);

For number:=1 to 10 do

Begin

Inc(spusk,30);

Str(number, s_l);

S:=’Level ‘+s_l;

Settextstyle(4{GothicFont},horizdir,4);

Settextjustify(lefttext, centertext);

Outtextxy(4,spusk, s);

End;

Close(f);

Repeat

If keypressed then

Begin

S:=readkey;

Val(s, number, code);

Case number of

0:begin

Assign(f_s,’levels\level10.den’);

Erase(f_s);

Rename(f,’levels\level10.den’);

Exit;

End

Else if number in [1..9] then

Begin

Assign(f_s,’levels\level’+s+’.den’);

Erase(f_s);

Rename(f,’levels\level’+s+’.den’);

Exit;

End;

End;

End;

Until false;

End;

Var j:1..494;

Begin

{for j:=1 to 494 do

A[j]:=0;}

I:=1;

Randomize;

Text_na_ekran;

Initgr;

Build_level;

Mouseoff;

Closegraph;

End.

Ñïèñîê èñïîëuçoa ìîe ëèòaðàòoðû:

1. bi Áaëaoêèe “Òoðaî Результаты поискаàñêàëu ñ ãðàôèêîe aëÿ ïaðñîiàëuiûõ êî ìïuþòaðîâ”

2. Walasek J. Konwersacyjne otoczenie programowe Pascala. WNT, Warsawa

3. Turbo Tutor. Borland International. Scotts Valley, California

4. Cherry G. Pascal Programming Structures. Reston Publishing Company. Reston, Virginia


Арканоид на Паскале