Timeline for Tic-Tac-Toe in C++11 - follow-up 2
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:40 | history | edited | CommunityBot |
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
|
|
Nov 27, 2014 at 15:27 | comment | added | MORTAL | @GoswinvonBrederlow ... i make it work to handle any mesh nXn. would you check it whether it's ok or need further work. | |
Nov 27, 2014 at 15:16 | vote | accept | MORTAL | ||
Nov 27, 2014 at 15:02 | answer | added | MORTAL | timeline score: 0 | |
Nov 27, 2014 at 13:12 | answer | added | Edward | timeline score: 4 | |
Nov 27, 2014 at 12:50 | comment | added | Goswin von Brederlow |
Indeed. Using enums seems to be going the wrong way. That hardcodes things. Using indexes and iterators makes it flexible. Define a row, column and diagonal class (lets call that a Line ) and give TicTacToe an iterator over all rows, all columns and all diagonals (all lines). Row, column and diagonal again can have an iterator over its fields. You then can check for win with for (auto line : TicTacToe.lines()) { bool win = True; for (auto field : line.fields()) { if {field.player() != player) { win = false; break; } } if (win) return true; } return false; }
|
|
Nov 27, 2014 at 4:24 | comment | added | MORTAL |
@GoswinvonBrederlow ... to make this code be able to handle a mesh nXn seems impossible with enum struct .
|
|
Nov 26, 2014 at 18:10 | history | edited | Jamal | CC BY-SA 3.0 |
added 100 characters in body; edited title
|
Nov 26, 2014 at 18:08 | history | edited | MORTAL | CC BY-SA 3.0 |
edited title
|
Nov 26, 2014 at 17:53 | comment | added | MORTAL | @GoswinvonBrederlow .. AL is so interesting subject i'm currently reading related subject. | |
Nov 26, 2014 at 17:15 | comment | added | Goswin von Brederlow | And some new improvement: Add an AI for single player games. | |
Nov 26, 2014 at 17:14 | comment | added | Goswin von Brederlow | Yes, this can be improved to be able to handle e.g. a 4x4 board. See any of the previous tic-tac-toe questions for details. | |
Nov 26, 2014 at 16:33 | history | edited | MORTAL | CC BY-SA 3.0 |
deleted 115 characters in body; edited title
|
Nov 26, 2014 at 16:07 | history | asked | MORTAL | CC BY-SA 3.0 |