<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 閱讀(462) 評論(0)  編輯  收藏 所屬分類: ruby-寶石也鋒芒
    主站蜘蛛池模板: 99久久免费观看| 免费A级毛片无码视频| 国产精品久久免费视频| 久久亚洲精品国产精品婷婷| 免费观看黄色的网站| 亚洲精品中文字幕无码AV| 亚洲成人免费电影| 激情综合亚洲色婷婷五月APP| 国产福利在线观看免费第一福利| 亚洲国产精品综合久久2007| 日本阿v免费费视频完整版| 亚洲色欲色欲www| 日韩一级视频免费观看| 丰满亚洲大尺度无码无码专线| 波多野结衣中文一区二区免费| 成年网在线观看免费观看网址| 亚洲日韩欧洲无码av夜夜摸| 国产免费无码一区二区| 亚洲高清无在码在线无弹窗| 我要看免费的毛片| 免费大片av手机看片高清| 亚洲中文字幕无码永久在线| 日韩精品无码免费一区二区三区| 亚洲日本在线观看网址| 日本免费高清一本视频| jizz18免费视频| 亚洲第一网站免费视频| 永久久久免费浮力影院| 久久免费观看视频| 亚洲av产在线精品亚洲第一站| 在线播放免费播放av片| 免费无码黄网站在线看| 精品亚洲国产成人| 亚洲精品无码久久不卡| 久久综合国产乱子伦精品免费| 亚洲性色精品一区二区在线| 狠狠色婷婷狠狠狠亚洲综合| 亚洲国产精品免费在线观看| 无码av免费一区二区三区| 亚洲精品永久www忘忧草| 好爽好紧好大的免费视频国产|