编程介的小学生 2017-01-30 16:10 采纳率: 20.5%
浏览 989
已采纳

Cubic Tick-Tack-Toe

Description

Tick-Tack-Toe is a famous simple game that is played on 3*3 grids. Two players put stones in the grids alternately and each one has his own color of stones that differ from the opponent's. The player that first gets a line of three stones vertically, horizontally, or diagonally wins the game. If the grids are all filled and no one makes a line of tree stones, the game is called a draw.

Sram Eel loves playing Tick-Tack-Toe very much. He plays it with his friend Tzxhsw every day. However, because of his weak skills, he always loses the game. Recently, he finally angers and decides to change the game to make it more interesting, that is, Cubic Tick-Tack-Toe!

Cubic Tick-Tack-Toe is played in 3*3*3 grids. Players put stones in the grids from bottom to top alternately, i.e. a stone cannot be putted in a grid, which is upon an empty grid. A player can win the game through getting one of the 49 lines of three stones. Tzxhsw is not so skilled in such a strange game, so she requests your help. To show your pure virtue, please put up your hands and knock on your keyboard!
Input

The input contains multiple test cases. Each test case contains 9 lines describing the current grids. A '.' denotes an empty grid, a 'O' denotes a stone put by the player taking the first turn, and a 'X' denotes a stone put by another player. The grids are described from bottom to top. Your program should estimate which player takes the next turn and analyze whether he can win the game or not.
Output

There is only one line for each test case. If the player taking the next turn can manage to win the game, print "WIN". If he will lose, print "LOSE". If the game will become a draw, print "DRAW".
Sample Input

OXX
..O
...
XO.
...
...
OX.
...
...

OX.
...
..O
XO.
...
...
OX.
...
...
Sample Output

WIN
LOSE

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-02-06 15:45
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP