<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-寶石也鋒芒
    主站蜘蛛池模板: 国产亚洲精彩视频| 亚洲国产精品久久久久婷婷软件 | 三年片在线观看免费大全电影| 国产国产人免费人成免费视频| 亚洲人成网站色7799| 亚洲中文字幕在线观看| 青青免费在线视频| 日韩免费人妻AV无码专区蜜桃| 亚洲人成伊人成综合网久久久 | 91天堂素人精品系列全集亚洲| 久久青草国产免费观看| 亚洲AV日韩精品久久久久久久 | 免费va在线观看| 人妖系列免费网站观看| 亚洲深深色噜噜狠狠爱网站| 成人精品视频99在线观看免费| 日本三级2019在线观看免费| 亚洲白色白色在线播放| 成人免费视频软件网站| 亚洲AV无码AV日韩AV网站| 亚洲成?v人片天堂网无码| 波多野结衣免费视频观看| 亚洲欧洲国产精品香蕉网| 国产日韩久久免费影院| 亚洲成av人影院| 国产产在线精品亚洲AAVV| va亚洲va日韩不卡在线观看| 亚洲一本综合久久| 国产精品久久亚洲一区二区| 免费看黄的成人APP| 亚洲午夜国产精品| 免费高清在线爱做视频| eeuss影院免费92242部| 四虎国产精品成人免费久久| 亚洲第一页在线播放| 国产亚洲AV无码AV男人的天堂| 久久久青草青青国产亚洲免观 | a级精品九九九大片免费看| 亚洲精品乱码久久久久蜜桃 | 亚洲精品无码专区在线播放| 亚洲日韩国产一区二区三区在线 |