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

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

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

    ivaneeo's blog

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

      BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
      669 Posts :: 0 Stories :: 64 Comments :: 0 Trackbacks
    看rrobots的一個(gè)簡(jiǎn)單的例子:

    ----------------------- 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 -----------------------

    這里至少要實(shí)現(xiàn)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) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): ruby-寶石也鋒芒
    主站蜘蛛池模板: 亚洲视频一区在线播放| 国产v精品成人免费视频400条| 亚洲一线产品二线产品| 亚洲老妈激情一区二区三区| 最近最新中文字幕完整版免费高清| 91在线免费观看| 免费一级毛suv好看的国产网站| 亚洲一卡2卡3卡4卡国产网站| 亚洲国产精品成人精品无码区| 免费成人在线观看| 成年女人看片免费视频播放器| 一级毛片不卡片免费观看| 国产人成网在线播放VA免费| 亚洲a∨无码精品色午夜| 亚洲中文字幕无码av在线| 亚洲AV无码一区二区二三区入口| 亚洲精品国产日韩无码AV永久免费网| 好吊妞788免费视频播放 | 国产啪亚洲国产精品无码 | 亚洲av无码一区二区三区人妖| 亚洲无人区视频大全| 亚洲AV无码久久| 国产日韩亚洲大尺度高清| 国产成人亚洲综合| 亚洲高清最新av网站| 国产jizzjizz视频全部免费| 午夜dj在线观看免费视频| 毛片免费vip会员在线看| 国产又黄又爽又猛免费app| 亚洲免费视频网址| 四虎免费影院ww4164h| 亚洲一级免费毛片| 99久久99这里只有免费费精品| 永久免费在线观看视频| 96免费精品视频在线观看| 91精品国产免费网站| 19禁啪啪无遮挡免费网站| 午夜国产精品免费观看| 精品熟女少妇AV免费观看| 在线播放高清国语自产拍免费| 麻豆国产人免费人成免费视频|