his case, ` fmt.Printf ` uses the method internally to convert a ` player
` into a string, then prints it out.

#  Testing the game

Now we compile and run the game:

__ __

`

    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    

|

    
    
    next player to place a mark is: cross
       |   |  
    ------------
       |   |  
    ------------
       |   |  
    where to place a cross? (input row then column, separated by space)
    > 1 1
    
    next player to place a mark is: circle
     X |   |  
    ------------
       |   |  
    ------------
       |   |  
    where to place a circle? (input row then column, separated by space)
    > 1 2
    
    ...
    
    next player to place a mark is: cross
     X | O | X
    ------------
     O | O | X
    ------------
       | X | O
    where to place a cross? (input row then column, separated by space)
    > 3 1
     X | O | X
    ------------
     O | O | X
    ------------
     X | X | O
    the game has ended with a draw!
      
  
---|---  
`

From another run:

__ __

`

    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    

|

    
    
    ...
    
    next player to place a mark is: circle
     X | X | O
    ------------
     X | O |  
    ------------
       |   |  
    where to place a circle? (input row then column, separated by space)
    > 3 1
    
     X | X | O
    ------------
     X | O |  
    ------------
     O |   |  
    circle won the game!
      
  
---|---  
`

**There you have it, a fully working tic-tac-toe in Go.**

__ [ Execises ](/categories/execises/) , [ Golang ](/categories/golang/)

__ [ golang ](/tags/golang/) [ project ](/tags/project/)

This post is licensed under [ CC BY 4.0
](https://creativecommons.org/licenses/by/4.0/) by the author.

Share  [ __
](https://twitter.com/intent/tweet?text=Golang%20Project:%20Tic%20Tac%20Toe%20-%20Miigon's%20blog&url=https%3A%2F%2Fblog.miigon.net%2Fposts%2Fgolang-
project-tic-tac-toe%2F "Twitter") [ __
](https://www.facebook.com/sharer/sharer.php?title=Golang%20Project:%20Tic%20Tac%20Toe%20-%20Miigon's%20blog&u=https%3A%2F%2Fblog.miigon.net%2Fposts%2Fgolang-
project-tic-tac-toe%2F "Facebook") [ __
](https://t.me/share/url?url=https%3A%2F%2Fblog.miigon.net%2Fposts%2Fgolang-
project-tic-tac-
toe%2F&text=Golang%20Project:%20Tic%20Tac%20Toe%20-%20Miigon's%20blog
"Telegram") __

Recently Updated

  * [ [mit6.s081] 笔记 Lab10: Mmap | 文件内存映射 ](/posts/s081-lab10-mmap/)
  * [ [随笔]文件系统上存储哈希对象：哈希算法以及目录结构对性能的影响 ](/posts/storing-hash-objects-on-filesystem/)
  * [ git的前世，和BitKeeper ](/posts/origin-of-git-feat-bitkeeper/)
  * [ 随笔：Golang 循环变量引用问题以及官方语义修复 ](/posts/golang-loop-var-reference-problems-and-semantic-fix/)
  * [ [mit6.s081] 笔记 Lab6: Copy-on-write fork | fork 懒拷贝 ](/posts/s081-lab6-copy-on-write-fork/)

Trending Tags

[ operating system ](/tags/operating-system/) [ Chinese ](/tags/chinese/) [
system design ](/tags/system-design/) [ C++ ](/tags/c/) [ course
recommendation ](/tags/course-recommendation/) [ gRPC ](/tags/grpc/) [
translated ](/tags/translated/) [ announcement ](/tags/announcement/) [ c++
standard ](/tags/c-standard/) [ computer system ](/tags/computer-system/)

Friend Links

  * [ 0xffff.one 搬砖技术社区 ](http://0xffff.one)
  * [ ZGQ's Blog ](https://blog.izgq.net)

Contents

###  Further Reading

[ _Mar 15, 2023_ 随笔：Golang 循环变量引用问题以及官方语义修复  这篇文章谈一个已经在 Golang
中存在多年的，几乎每一个新手都要被坑一遍的设计：引用捕获了循环变量，且逃逸出循环迭代范围而造成的逻辑错误。
以及重点是讨论了目前对这个常见问题的解决办法的探索（静态分析存在的不足，以及2022年10月 Golang 官方提出的直接更改 for
循环变量语义，从语言设计上根本地消除这个问题的 proposal） background 这个问题是一个 Go...  ](/posts/golang-
loop-var-reference-problems-and-semantic-fix/)

[ _Dec 30, 2022_ [随笔]文件系统上存储哈希对象：哈希算法以及目录结构对性能的影响  从文件系统的实现原理角度讨论
/77/e1/77e1cccccc... 模式的 hash object 命名的优点以及必要/不必要性，以及算法选择。 原贴 这是我在 0xffff
论坛的回帖的备