mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
d0cafb0198
Update and fix more documentation. Alter Splash messages and logo color.
165 lines
17 KiB
HTML
Executable file
165 lines
17 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.06">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>I8</span><span class=cF0> board [</span><span class=cFE>9</span><span class=cF0>];
|
|
<a name="l2"></a></span><span class=cF9>I64</span><span class=cF0> board_x[</span><span class=cFE>9</span><span class=cF0>] = {</span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>, </span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>, </span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>};
|
|
<a name="l3"></a></span><span class=cF9>I64</span><span class=cF0> board_y[</span><span class=cFE>9</span><span class=cF0>] = {</span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>150</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>250</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>, </span><span class=cFE>350</span><span class=cF0>};
|
|
<a name="l4"></a>
|
|
<a name="l5"></a></span><span class=cF1>U0</span><span class=cF0> DrawX(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l6"></a>{
|
|
<a name="l7"></a> dc->thick = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l8"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x - </span><span class=cFE>20</span><span class=cF0>, y - </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, x + </span><span class=cFE>20</span><span class=cF0>, y + </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l9"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x + </span><span class=cFE>20</span><span class=cF0>, y - </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, x - </span><span class=cFE>20</span><span class=cF0>, y + </span><span class=cFE>20</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l10"></a>}
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF1>U0</span><span class=cF0> DrawO(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
|
|
<a name="l13"></a>{
|
|
<a name="l14"></a> dc->thick = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l15"></a> </span><span class=cF5>GrCircle3</span><span class=cF0>(dc, x, y, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>25</span><span class=cF0>);
|
|
<a name="l16"></a>}
|
|
<a name="l17"></a>
|
|
<a name="l18"></a></span><span class=cF1>U0</span><span class=cF0> DrawBoard(</span><span class=cF9>I64</span><span class=cF0> player)
|
|
<a name="l19"></a>{
|
|
<a name="l20"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l21"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc = </span><span class=cF5>DCAlias</span><span class=cF0>;
|
|
<a name="l22"></a>
|
|
<a name="l23"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
|
<a name="l24"></a> dc->thick = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l25"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>200</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>200</span><span class=cF0>, </span><span class=cFE>400</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l26"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>300</span><span class=cF0>, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>300</span><span class=cF0>, </span><span class=cFE>400</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l27"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>200</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>400</span><span class=cF0>, </span><span class=cFE>200</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l28"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, </span><span class=cFE>100</span><span class=cF0>, </span><span class=cFE>300</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>400</span><span class=cF0>, </span><span class=cFE>300</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l29"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>9</span><span class=cF0>; i++)
|
|
<a name="l30"></a> </span><span class=cF1>switch</span><span class=cF0> (board[i])
|
|
<a name="l31"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
|
<a name="l33"></a> DrawX(dc, board_x[i], board_y[i]);
|
|
<a name="l34"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
|
<a name="l37"></a> DrawO(dc, board_x[i], board_y[i]);
|
|
<a name="l38"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l39"></a>
|
|
<a name="l40"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l41"></a> </span><span class=cF2>//mouse.pos.x, mouse.pos.y are mouse x, y.</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF2>//mouse.lb</span><span class=cF0> </span><span class=cF2>is mouse left bttn</span><span class=cF0>
|
|
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (player == </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l44"></a> DrawX(dc, </span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cF5>Fs</span><span class=cF0>->pix_left, </span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cF5>Fs</span><span class=cF0>->pix_top);
|
|
<a name="l45"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l46"></a> DrawO(dc, </span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cF5>Fs</span><span class=cF0>->pix_left, </span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cF5>Fs</span><span class=cF0>->pix_top);
|
|
<a name="l47"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
|
|
<a name="l48"></a>}
|
|
<a name="l49"></a>
|
|
<a name="l50"></a></span><span class=cF1>U0</span><span class=cF0> TakeTurn(</span><span class=cF9>I64</span><span class=cF0> player)
|
|
<a name="l51"></a>{
|
|
<a name="l52"></a> </span><span class=cF9>I64</span><span class=cF0> i, x = </span><span class=cFE>0</span><span class=cF0>, y = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l53"></a>
|
|
<a name="l54"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>100</span><span class=cF0> <= x < </span><span class=cFE>400</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cFE>100</span><span class=cF0> <= y < </span><span class=cFE>400</span><span class=cF7>)</span><span class=cF0> || board[i])
|
|
<a name="l55"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (player == </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l57"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l58"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l59"></a> </span><span class=cF5>Beep</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l60"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cFB>mouse</span><span class=cF0>.lb)
|
|
<a name="l61"></a> {
|
|
<a name="l62"></a> DrawBoard(player);
|
|
<a name="l63"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l64"></a> }
|
|
<a name="l65"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>mouse</span><span class=cF0>.lb)
|
|
<a name="l66"></a> {
|
|
<a name="l67"></a> DrawBoard(player);
|
|
<a name="l68"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
|
|
<a name="l69"></a> }
|
|
<a name="l70"></a> x = </span><span class=cFB>mouse</span><span class=cF0>.pos.x - </span><span class=cF5>Fs</span><span class=cF0>->pix_left;
|
|
<a name="l71"></a> y = </span><span class=cFB>mouse</span><span class=cF0>.pos.y - </span><span class=cF5>Fs</span><span class=cF0>->pix_top;
|
|
<a name="l72"></a> i = (x - </span><span class=cFE>100</span><span class=cF0>) / </span><span class=cFE>100</span><span class=cF0> + (y - </span><span class=cFE>100</span><span class=cF0>) / </span><span class=cFE>100</span><span class=cF0> * </span><span class=cFE>3</span><span class=cF0>;
|
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l74"></a> board[i] = player;
|
|
<a name="l75"></a>}
|
|
<a name="l76"></a>
|
|
<a name="l77"></a></span><span class=cF1>Bool</span><span class=cF0> CheckWinner(</span><span class=cF9>I64</span><span class=cF0> player)
|
|
<a name="l78"></a>{
|
|
<a name="l79"></a> </span><span class=cF1>if</span><span class=cF0> ( player == board[</span><span class=cFE>0</span><span class=cF0>] == board[</span><span class=cFE>1</span><span class=cF0>] == board[</span><span class=cFE>2</span><span class=cF0>] ||
|
|
<a name="l80"></a> player == board[</span><span class=cFE>3</span><span class=cF0>] == board[</span><span class=cFE>4</span><span class=cF0>] == board[</span><span class=cFE>5</span><span class=cF0>] ||
|
|
<a name="l81"></a> player == board[</span><span class=cFE>6</span><span class=cF0>] == board[</span><span class=cFE>7</span><span class=cF0>] == board[</span><span class=cFE>8</span><span class=cF0>] ||
|
|
<a name="l82"></a> player == board[</span><span class=cFE>0</span><span class=cF0>] == board[</span><span class=cFE>3</span><span class=cF0>] == board[</span><span class=cFE>6</span><span class=cF0>] ||
|
|
<a name="l83"></a> player == board[</span><span class=cFE>1</span><span class=cF0>] == board[</span><span class=cFE>4</span><span class=cF0>] == board[</span><span class=cFE>7</span><span class=cF0>] ||
|
|
<a name="l84"></a> player == board[</span><span class=cFE>2</span><span class=cF0>] == board[</span><span class=cFE>5</span><span class=cF0>] == board[</span><span class=cFE>8</span><span class=cF0>] ||
|
|
<a name="l85"></a> player == board[</span><span class=cFE>0</span><span class=cF0>] == board[</span><span class=cFE>4</span><span class=cF0>] == board[</span><span class=cFE>8</span><span class=cF0>] ||
|
|
<a name="l86"></a> player == board[</span><span class=cFE>2</span><span class=cF0>] == board[</span><span class=cFE>4</span><span class=cF0>] == board[</span><span class=cFE>6</span><span class=cF0>])
|
|
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l89"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l90"></a>}
|
|
<a name="l91"></a>
|
|
<a name="l92"></a></span><span class=cF1>U0</span><span class=cF0> DoGame()
|
|
<a name="l93"></a>{
|
|
<a name="l94"></a> </span><span class=cF9>I64</span><span class=cF0> moves = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l95"></a>
|
|
<a name="l96"></a> </span><span class=cF5>MemSet</span><span class=cF0>(board, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>board</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l97"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l98"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l99"></a> TakeTurn(</span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l100"></a> </span><span class=cF1>if</span><span class=cF0> (CheckWinner</span><span class=cF7>(</span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l101"></a> {
|
|
<a name="l102"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l103"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l104"></a> </span><span class=cF5>Beep</span><span class=cF0>;
|
|
<a name="l105"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l106"></a> }
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (++moves == </span><span class=cFE>9</span><span class=cF0>)
|
|
<a name="l108"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l109"></a>
|
|
<a name="l110"></a> TakeTurn(</span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (CheckWinner</span><span class=cF7>(</span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l112"></a> {
|
|
<a name="l113"></a> </span><span class=cF5>Beep</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l114"></a> </span><span class=cF5>Beep</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l115"></a> </span><span class=cF5>Beep</span><span class=cF0>(</span><span class=cFE>74</span><span class=cF0>);
|
|
<a name="l116"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l117"></a> }
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (++moves == </span><span class=cFE>9</span><span class=cF0>)
|
|
<a name="l119"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l121"></a>}
|
|
<a name="l122"></a>
|
|
<a name="l123"></a></span><span class=cF1>U0</span><span class=cF0> TicTacToe()
|
|
<a name="l124"></a>{
|
|
<a name="l125"></a> </span><span class=cF5>WinMax</span><span class=cF0>; </span><span class=cF2>//Maximize window</span><span class=cF0>
|
|
<a name="l126"></a> </span><span class=cF5>DocClear</span><span class=cF0>; </span><span class=cF2>//Clear window text.</span><span class=cF0>
|
|
<a name="l127"></a> </span><span class=cF6>"$GREEN$CTRL-ALT-c$FG$ to exit.\n"</span><span class=cF0>;
|
|
<a name="l128"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l129"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l130"></a> DoGame;
|
|
<a name="l131"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
|
<a name="l133"></a> </span><span class=cF5>DCFill</span><span class=cF0>;
|
|
<a name="l134"></a>}
|
|
<a name="l135"></a>
|
|
<a name="l136"></a>TicTacToe;
|
|
</span></pre></body>
|
|
</html>
|