edisonhello
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 2019 台大椰林資訊營 AI Challenge Oil Tycoon 遊戲介紹 [TOC] ## 遊戲內容 * 本遊戲共有四位玩家,玩家們在石油神的眷顧下互相競爭,在遊戲時間結束時,由基地內擁有最多石油的玩家獲勝。 * 因為來自石油神的奇蹟,地圖上將隨機生成不同價值的石油(越靠螢幕中央,價值越高),且石油的顏色代表著他的價值的範圍,玩家可以自己觀察。玩家可移動到石油的位置上來獲得油,但身上的石油越多,行動速度會越慢,但若回到基地,可將身上石油全數放入基地,行動速度則回復為初始值。 * 移動速度會隨著油量的增加而線性遞減,降到一定程度之後會是定值。 * 玩家若和其他玩家碰撞,石油神會進行強制共產,把所有碰撞玩家身上的油量均分 * 遊戲場地中央為自經區,石油神認為貨出得去就能發大財,所以會在自經區內販賣道具,每個道具有不一樣的價值和效果,玩家到自經區時可用身上的石油跟石油神買道具,但若道具滯銷,石油神會自行銷毀。 * 寵物系統:每經過一段時間,寵物會出發尋找玩家,並將玩家身上一部分的油(最多1000)帶回基地,讓玩家可以放心採集。 ## 手動控制 ![](https://i.imgur.com/G9TbyV5.png) `wasd/tfgh/ijkl/上下左右`: 控制玩家的方向。 `q e/r y/u o/RSHIFT RCTRL`: 買道具=使用道具(由於在擁有或使用道具中時不能再購買,因此是同個操作)(兩個按鍵通用,只是看你習慣按左邊右邊)。 ## 石油等級與價值 | Level | Value | | ----- | ----- | | 1 | 50~400 | | 2 | 400~600 | | 3 | 600~800 | | 4 | 800~1200 | ## 道具 (item) | item/skill | price | | -------- | -------- | | IGoHome | 500 | | OtherGoHome | 500 | | TheWorld | 1450 | | MagnetAttract | 689 | | Invincible | 500 | | RadiusNotMove | 500 | | RadiationOil | 1000 | | ShuffleBases | 1 | * `噴射背包 (IGoHome)` * 讓自己瞬間回到基地。 ![](https://i.imgur.com/nZaQ3GW.png =x150) * `通通都進來吧 (OtherGoHome)` * 讓除了自己的所有人瞬間回到基地。 ![](https://i.imgur.com/gV6n48l.png =x150) * `跟著月亮走 (MagnetAttract)` * 在三秒內吸引玩家周圍的石油。 ![](https://i.imgur.com/8ROsyj6.png =x150) * `地溝油 (RadiationOil)` * 在基地附近使用,讓範圍內基地的石油數減少(*0.9)。 ![](https://i.imgur.com/X93p7B0.png =x150) * `無敵 (Invincible)` * 在一定時間內不會被共產。 ![](https://i.imgur.com/G2XWtsg.png =x150) * `寒粉 (RadiusNotMove)` * 冰凍玩家,使一定範圍之內除了自己的玩家都無法移動。 ![](https://i.imgur.com/AEYFvNu.png =x150) * `遷都 (ShuffleBases)` * 隨機更換基地。 ![](https://i.imgur.com/2boDert.png =x150) * `世界 (TheWorld)` * 發動 "The world" 的效果中,只有發動的玩家本人可以自行移動,彷彿這是屬於他的世界一樣 * 只有發動世界的玩家有絕對的自由,例如移動、撿石油、使用其他道具、共產別人 ![](https://i.imgur.com/X1jI5S2.png =x150) * {%youtube -FT23AwNPOM%} * {%youtube soyMVOxsy1Q%} 括號內的是物品在遊戲中的名稱,helper 之中跟道具有關的名稱就是指此。 <!-- $Dist(m_q) = Dist(W, N) = D(I, J) /( |W| + |N|)$ --> ## 裝備 有5種可以透過小隊表現得到的裝備卡,每張都能提供某種能力的增幅,有下列五種: * `走到飛跑步鞋` * 裝備者移動速度乘以1.1倍 * `666幸運戒指` * 得到的石油乘以1.1倍 * `馮迪索牌防盜鎖` * 得到500單位的隨身保險,當被觸發平均而將失去石油時,保險額內的石油不會被平均 * `別靠背厭世包` * 寵物的攜帶上限乘以1.5倍 * `曲中人散熱器` * 寵物的冷卻時間乘以0.8倍 在AI中`__init__`函式中加入`self.equipments = (a, b, c, d, e)`的5-tuple,代表每種裝備卡你有幾張。 ## `decide()`的回傳值 * `AI_DIR_STOP` => 停 * `AI_DIR_U` => 上 * `AI_DIR_RU` => 右上 * `AI_DIR_R` => 右 * `AI_DIR_RD` => 右下 * `AI_DIR_D` => 下 * `AI_DIR_LD` => 左下 * `AI_DIR_L` => 左 * `AI_DIR_LU` => 左上 * `AI_TRIGGER_ITEM` => 買/用道具 ## 地圖相關設定 左上角是原點,對於所有位置,第一個index是x軸,第二個index是y軸,往右是x正向,往下是y正向 示意圖: ![](https://i.imgur.com/Hhqm0Ew.png) ## Helper 以下所有需要 `player_id` 作為參數的函數,如果不傳這個參數的話,就會預設自動代入自己的 id。id 的編號從 `0` 開始。 ### 常數 * `player_id: int` * 獲得自己的 id。 * `oil_radius: int` * 油的半徑。 * `player_radius: int` * 玩家半徑。 * `player_normal_speed: float` * 玩家沒有負載時的速度。 * `base_length: int` * 基地邊長。 * `game_size: tuple(int, int)` * 遊戲場地大小。 * `market_position: tuple(int, int)` * 市場位置。 * `market_radius: int` * 市場半徑 * `radius_not_move_radius: int` * "寒粉"的有效半徑。 * `radius_of_radiation_oil: int` * 獲得"地溝油"的有效半徑。 * `radius_of_magnetic_attract: int` * 獲得"跟著月亮走"的有效半徑。 ### 玩家相關 * 通用規則: 所有需要有`player_id`參數的函數,可以不傳入此參數,來代表`player_id`為自己的id。 * `get_players_position(): [tuple(int, int), ...]` * 獲得所有玩家的位置。 * 回傳值是長度為 4 的 list,第 i 個元素代表第 i 個玩家的位置。 * `get_player_position(player_id): tuple(int, int)` * 獲得 `player_id` 的位置。 * `get_players_direction(): [tuple(int, int), ...]` * 獲得所有玩家的方向。 * 回傳值跟 `get_players_position` 同理。每個方向的長度都是 1。 * `get_player_direction(player_id): tuple(int, int)` * 獲得 `player_id` 的方向。 * `get_players_value(): [float, ...]` * 獲得所有玩家身上的油量。 * 回傳值跟 `get_players_position` 同理。 * `get_player_value(player_id): float` * 獲得 `player_id` 身上的油量。 * `get_players_speed(): [float, ...]` * 獲得所有玩家的當前速度(經過負載加成後的速度)。 * 回傳值跟 `get_players_position` 同理。 * `get_player_speed(player_id): float` * 獲得 `player_id` 的當前速度。 * `get_players_is_invincible(): [bool, ...]` * 獲得所有玩家目前是否無敵。 * 回傳值跟 `get_players_position` 同理。 * `get_player_is_invincible(player_id): bool` * 獲得 `player_id` 目前是否無敵。 * `get_players_insurance_value(): [int, ...]` * 獲得所有玩家碰撞時的保底價值(不會被均分的價值量)。 * 回傳值跟 `get_players_position` 同理。 * `get_player_insurance_value(player_id): int` * 獲得 `player_id` 的碰撞保底價值。 ### 其他資訊 * `get_oils(): [tuple(float, float), ...]` * 獲得場上所有油的位置。 * `get_oils_level(): [int, ...]` * 獲得場上所有油的等級。 * `get_oils_distance_to_center(): [float, ...]` * 獲得場上所有油到地圖中心的距離。 * 以上這三個函數的油是共享 index 的。即相同 index 代表的是同一個油。 * `get_oils_by_distance_from_center(): [tuple(float, float), ...]` * 獲得場上所有油的位置,以到地圖中心的距離排序。 * `get_bases_center(): [tuple(int, int), ...]` * 獲得所有玩家基地的位置。 * 回傳值跟 `get_players_position` 同理。 * `get_base_center(player_id): tuple(int, int)` * 獲得 `player_id` 基地的位置。 * `get_base_value(player_id): int` * 獲得 player_id 基地的油量。 * `get_bases_value(): [int, ...]` * 獲得所有玩家的基地油量。 * 回傳值跟 `get_players_position` 同理。 * `get_market(): tuple(str, int, int)` * 獲得市場販賣中的物品資訊。 * 元素分別是物品名稱、價錢,以及下一個物品出現的倒數計時。 * 如果市場中現在有物品,那倒數計時會是 0。 * 如果市場中現在沒有物品,那倒數計時會是距離物品出現的剩餘 tick 數,且前兩個元素會是 `None`。 * `get_player_item_name(player_id): str` * 獲得 `player_id` 持有的物品名稱。 * 如果沒有物品的話,那麼回傳值是 `None`。 * `get_player_item_is_active(player_id): bool` * 獲得 `player_id` 所持有的道具是否正在發動。 * `get_player_item_duration(player_id): int` * 獲得 `player_id` 所持有的道具剩餘有效 tick 數量。如果道具尚未被發動,那麼回傳值是 `0`。 * `get_timer(): int` * 獲得距離遊戲結束剩餘的 tick 數量。 ### 其他 * `get_nearest_player(player_id): int` * 獲得離 `player_id` 最近的玩家 id。 * `get_nearest_oil(player_id): tuple(float, float)` * 獲得離 `player_id` 最近的油的位置。 * `get_most_valuable_player(): int` * 獲得<del>最油</del>身上價值最高的玩家 id。 * `get_distance(p = tuple(float, float) or Vector2, q = tuple(float, float) or Vector2): float` * 獲得 `p` 跟 `q` 的距離。 * 其實就是平方相加開根號。 * `get_distance_to_center(p = tuple(float, float) or Vector2): float` * 獲得 `p` 到地圖中心的距離。 * `get_direction(vector = tuple(x, y)): int` * 很重要的功能,取得方向代號。 * 當你決定了目的地,傳入(目的地 - 自己位置),可以得到一個代表對應的方向的整數。 ## 可用顏色 ![](https://i.imgur.com/OREU7Ru.png) 當然,也可以找自己喜歡的顏色。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully