编程介的小学生 2020-02-03 21:50 采纳率: 20.5%
浏览 179

New Game 策略游戏算法

Problem Description
While ZSTU’s acmers were coding, coach Yehr was so bored that he created a new game to kill time. And the game is called “Yehr Game” because of the inventer.
Yehr Game is a board game involving two players. It is played on a board with 40 squares arranged in an ten-by-four grid. At the beginning of the game each player controls four pieces: one acm, one bahamas, one cab and one daze. If one player has no pieces to move, he lost the game.
Setup:
Yehr Game is played on a rectangle board of ten rows and four columns. The pieces are divided, by convention, into red and black sets. The players are referred to as "Red" and "Black", and each begins the game with four pieces of the specified color. These consist of one acm, one bahamas, one cab and one daze.

Movement:
First, they setup their pieces on the board.
(1) the piece red acm can be placed on A1~,A2,A3,A4,A5;the piece black acm A6~A10;
(2) the piece red bahamas can place on B1~B5; the piece black Bahamas B6~B10;
(3) the piece red cab can place on C1~C5; the piece black cab C6~C10;
(4) the piece red daze cab can place on D1~D5; the piece black daze D6~D10;
Second, they determine who moves first by dice. After the initial move, the players alternately move one piece at a time.
Each chess piece has its own style of moving.
(1) Acm can only move one direction: red from left to right; black from right to left. Acm can only move to the next square. If one player’s acm moves to a square with the opponent acm, he win the game.
(2) Bahamas and cab can move two direction: from left to right or from right to left. And they can move any number of squares but may not leap over other pieces.
(3) Daze can only move one direction: red from right to left; black from left to right.Daze can only move to the next square. In order to win the game, every clever player places the red daze on d5 and the black on d6.
Of Course, we assume that all players are clever.

Input
The input contains several test cases.
Each test case contains three lines:
First line contains one integer number 0 or 1: 0 indicated red move first and 1 black first.
Second line contains four integer numbers r1, r2, r3, r4 indicating the four red pieces’ square. For example, r3=3 indicating the red cab on C3.
Third line contains four integer numbers k1, k2, k3, k4 indicating the four black pieces’ square. For example, k1=9 indicating the black acm on A9.
We assume that r4 is always 5, and K4 is 6.

Output
For each test case, if red win print Red in a single line, else print Black.

Sample Input
0
4 5 5 5
7 6 6 6

Sample Output
Red

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作