<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    ivaneeo's blog

    自由的力量,自由的生活。

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
    看rrobots的一個簡單的例子:

    ----------------------- code -----------------------
    require 'robot'

    class NervousDuck
    ?? include Robot

    ? def tick events
    ??? turn_radar 1 if time == 0
    ??? turn_gun 30 if time < 3
    ??? accelerate 1
    ??? turn 2
    ??? fire 3 unless events['robot_scanned'].empty?
    ? end
    end

    ----------------------- code -----------------------

    這里至少要實現tick方法.

    下面是控制robot的一些方法和屬性:

    ? battlefield_height? #the height of the battlefield
    ? battlefield_width?? #the width of the battlefield
    ? energy????????????? #your remaining energy (if this drops below 0 you are dead)
    ? gun_heading???????? #the heading of your gun, 0 pointing east, 90 pointing
    ????????????????????? #north, 180 pointing west, 270 pointing south
    ? gun_heat??????????? #your gun heat, if this is above 0 you can't shoot
    ? heading???????????? #your robots heading, 0 pointing east, 90 pointing north,
    ????????????????????? #180 pointing west, 270 pointing south
    ? size??????????????? #your robots radius, if x <= size you hit the left wall
    ? radar_heading?????? #the heading of your radar, 0 pointing east,
    ????????????????????? #90 pointing north, 180 pointing west, 270 pointing south
    ? time??????????????? #ticks since match start
    ? speed?????????????? #your speed (-8/8)
    ? x?????????????????? #your x coordinate, 0...battlefield_width
    ? y?????????????????? #your y coordinate, 0...battlefield_height
    ? accelerate(param)?? #accelerate (max speed is 8, max accelerate is 1/-1,
    ????????????????????? #negativ speed means moving backwards)
    ? stop??????????????? #accelerates negativ if moving forward (and vice versa),
    ????????????????????? #may take 8 ticks to stop (and you have to call it every tick)
    ? fire(power)???????? #fires a bullet in the direction of your gun,
    ????????????????????? #power is 0.1 - 3, this power will heat your gun
    ? turn(degrees)?????? #turns the robot (and the gun and the radar),
    ????????????????????? #max 10 degrees per tick
    ? turn_gun(degrees)?? #turns the gun (and the radar), max 30 degrees per tick
    ? turn_radar(degrees) #turns the radar, max 60 degrees per tick
    ? dead??????????????? #true if you are dead
    ? say(msg)??????????? #shows msg above the robot on screen
    ? broadcast(msg)????? #broadcasts msg to all bots (they recieve 'broadcasts'
    ????????????????????? #events with the msg and rough direction)

    posted on 2006-11-18 00:33 ivaneeo 閱讀(468) 評論(0)  編輯  收藏 所屬分類: ruby-寶石也鋒芒
    主站蜘蛛池模板: 亚洲中文字幕无码不卡电影| 毛片基地免费视频a| 国产亚洲情侣一区二区无码AV| 中文字幕手机在线免费看电影| 国产成人综合亚洲| 日韩在线播放全免费| 亚洲视频网站在线观看| 99在线免费观看视频| 久久精品国产亚洲AV无码偷窥| 亚洲一线产区二线产区区| 成年女人免费碰碰视频| 亚洲国产成人久久精品软件| 女人18毛片免费观看| 日韩一区二区三区免费播放| 亚洲日韩人妻第一页| 一区二区三区精品高清视频免费在线播放 | 亚洲乱亚洲乱少妇无码| 四虎国产精品永免费| 亚洲一区二区视频在线观看| 在线免费观看伊人三级电影| 亚洲国语精品自产拍在线观看| 免费人成又黄又爽的视频在线电影| 暖暖免费日本在线中文| 18亚洲男同志videos网站| 可以免费看黄的网站| 美女视频黄频a免费| 亚洲国产精品自在拍在线播放| 亚洲91精品麻豆国产系列在线 | 在线亚洲高清揄拍自拍一品区| 久久免费观看视频| 婷婷亚洲久悠悠色悠在线播放| 日本特黄特色AAA大片免费| 最新亚洲成av人免费看| 四虎影视在线影院在线观看免费视频 | 久久精品国产亚洲精品| 国产免费爽爽视频在线观看| 亚洲精品视频专区| 四虎影院永久免费观看| 污污网站免费观看| 亚洲欧美国产日韩av野草社区| 中文字幕免费在线|