Tic-tac-toe: Difference between revisions

m
{{out}}
m (Added Common Lisp)
m ({{out}})
Line 1:
{{task|Games}}
Play a game of [[wp:Tic-tac-toe|tic-tac-toe]]. Ensure that legal moves are played and that a winning position is notified.
Ensure that legal moves are played and that a winning position is notified.
 
=={{header|Ada}}==
Line 128 ⟶ 129:
end Tic_Tac_Toe;</lang>
 
{{out}}
 
Output:
<pre>
> ./tic_tac_toe
Line 438:
 
</lang>
Output:{{out}} (nice ANSI formatting is not shown)
<pre>
Bic Bash Bow
Line 766:
//--------------------------------------------------------------------------------------------------
</lang>
Output:{{out}} Computer plays 'X' and human plays 'O'
<pre>
1 | 2 | X
Line 1,028:
}</lang>
 
{{out}}
Output example:
<pre>Welcome to Rosetta Code Tic-Tac-Toe for C#.
1 | 2 | 3
Line 1,167:
</lang>
 
{{out}}
Output example:
<pre>CL-USER> (tic-tac-toe)
Shall a computer play as X? (y/n)
Line 2,424:
putStrLn "Player X always begins."
</lang>
{{out}}
'''Output:'''
Player X is computer, O is human.
<pre>
Line 4,596:
((not (myMove)) "No moves")
((find3 0) "Sorry, you lost!") ) )</lang>
{{out}}
Output:
<pre>: (main)
+---+---+---+
Line 5,082:
print('\nA draw')</lang>
 
{{out}}
'''Sample output'''
<pre>
Tic-tac-toe game player.
Line 5,724:
<br>The &nbsp; '''LINESIZE.REX''' &nbsp; REXX program is included here ──► [[LINESIZE.REX]].<br>
 
'''output'''{{out}} when using the input of: &nbsp; <tt> -3 </tt>
<br>(a negative 3 indicates a grid of <tt> 3x3 </tt> and that the computer should play first.)
<br><br>Note: &nbsp; the user input is shown along with the program output.
Line 5,836:
─────────────────────────── The computer (O) won. ───────────────────────────
</pre>
'''output'''{{out}} when using the input of: &nbsp; <tt> 5 db </tt>
<br>(which indicates a grid of <tt> 5x5 </tt> and that the marker for the human is an ASCII hex db [█].)
<pre style="height:80ex">
Line 6,110:
Game.new(*players_with_human).play</lang>
 
{{out}}
sample output
<pre>
Computer0 goes first.
Line 6,368:
}</lang>
 
sample output{{out}} (human is always first)
<pre>
1 2 3
Anonymous user