Talk:Tic-tac-toe: Difference between revisions

m
m (→‎letting the human win (sometimes): added a truism (comment).)
 
(5 intermediate revisions by the same user not shown)
Line 12:
 
... And I like your printout of the board. I really did do a minimal version of the game for Python. Maybe someone else will do a fancy version in Python for comparison? --[[User:Paddy3118|Paddy3118]] 12:45, 5 February 2011 (UTC)
 
: I took that approach and added still more whitespace (for the REXX entry). &nbsp; To make the game board (grid) easier to see (without the reference numbers --- otherwise it gets cluttered/obfuscated pretty fast with any game board larger than nine cells) &nbsp; --- I removed the &nbsp; ''numbering'' &nbsp; grid and placed it to the right of the playing board (along with generous whitespace. &nbsp; --- this causes a reference game board (grid) to be displayed, making it a lot easier on the ole eyeballs to see who has what markers where, and what's available for a move (empty cell), and in specifying where to <strike>move</strike> place a piece/marker. &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 16:18, 3 October 2017 (UTC)
 
 
: An illuminating example &nbsp; (from a &nbsp; '''4'''&times;'''4''' &nbsp; tic─tac─toe game in progress):
<pre>
───────── computer places a marker [O] at cell number 16
 
║ ║ ║ │ │ │
║ ║ ║ 1 │ 2 │ 3 │ 4
║ ║ ║ │ │ │
═════╬═════╬═════╬═════ ─────┼─────┼─────┼─────
║ ║ ║ │ │ │
║ X ║ ║ X 5 │ 6 │ 7 │ 8
║ ║ ║ │ │ │
═════╬═════╬═════╬═════ ─────┼─────┼─────┼─────
║ ║ ║ │ │ │
║ O ║ ║ 9 │ 10 │ 11 │ 12
║ ║ ║ │ │ │
═════╬═════╬═════╬═════ ─────┼─────┼─────┼─────
║ ║ ║ │ │ │
║ ║ ║ O 13 │ 14 │ 15 │ 16
║ ║ ║ │ │ │
 
───────── Please enter a cell number to place your next marker [X] (or Quit):
</pre>
 
== letting the human win (sometimes) ==
A note on the REXX solution: &nbsp; tic-tac-toe games, &nbsp; if played perfectly, &nbsp; will always end in a draw, making it a &nbsp; [https://en.wikipedia.org/wiki/Futile_game futile game].
<br>(Except forFor the case for a &nbsp; '''2x2''' &nbsp; grid, a win is guaranteed for the player moving first.)
 
Since kids may be playing it &nbsp; (or adults with very short attention spans), &nbsp; I programmed a "hole" in the logic of the REXX program &nbsp; so that if a human player plays first (the default), &nbsp; they may win if a certain pair of moves are made. &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] 23:49, 10 December 2012 (UTC)
Line 25 ⟶ 51:
I'm surprised that &nbsp; BASIC, &nbsp; FORTRAN, &nbsp; and &nbsp; PL/I &nbsp; computer programming languages haven't had solutions entered &nbsp; (at the time of this posting). &nbsp; Tic-tac-toe was one of the first games written in any language as it was so simple to program and display. &nbsp; I still have my FORTRAN and PL/I programs laying around from the mid 1960s which played on a &nbsp; NxN &nbsp; grid. &nbsp; Now, if I could only find a card reader ... -- [[User:Gerard Schildberger|Gerard Schildberger]] 19:10, 23 April 2012 (UTC)
 
== 3D tic-taxtac-toe ==
 
Has anyone thought of writing/entering a &nbsp; '''3D''' &nbsp; version of tic-tac-toe for Rosetta Code &nbsp; (as a separate task, of course)?