美文网首页
NEUOJ-Game

NEUOJ-Game

作者: onionwyl | 来源:发表于2017-02-23 21:31 被阅读0次

Game

数据格式

  • 初始化init.json
{
   "map":[
       [0,0,0,0,0,0,0,1],
       [0,1,0,0,0,0,0,1],
       [0,0,3,0,0,0,0,1],
       [0,0,0,0,0,0,0,1]
   ],
   "player_count": 4,
   "player_id": [2013, 2124, 1084, 11],
   "player_pos": [
       [1,2],
       [3,4],
       [10, 0],
       [9, 8]
   ]
}
  • 每回合数据格式
{
    "round": 1,
    "player_count": 4,
    "player_id": [2013, 2124, 1084, 11],
    "player_action": [0,1,2,3],
    "item_count": 2,
    "item_properties": [
        [
            "type": "bomb",
            "data": [
                "pos": [1,2],
                "action": 0,
                "range": 11
            ]
        ],
        [
            "type": 2,
            "data": [
                "pos": [1,2],
                "action": 0,
            ]
        ]
    ],
    "dead":{
        [
            "player_id": 1,
            "reason": -10001
        ],
        [
            "player_id": 2,
            "reason": -10003
        ]
    }
}
  • 前端处理顺序
    • 读入init.json
    • 按照每回合的json,处理items
      • 首先处理爆炸
      • 处理角色移动
    • 处理完所有事件,读取排名

程序模块

  1. Runner(用来运行游戏规则的东西)
  2. Gamer(用户的程序)
  3. Guarder(守护进程)

相关文章

  • NEUOJ-Game

    Game 数据格式 初始化init.json 每回合数据格式 前端处理顺序读入init.json按照每回合的jso...

网友评论

      本文标题:NEUOJ-Game

      本文链接:https://www.haomeiwen.com/subject/bxfiwttx.html