劉家維
    • 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
      • Invitee
    • 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
    • Engagement control
    • 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 Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control 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
Invitee
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
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
###### tags: `2018CSIECAMP` # <center> 2018 台大椰林資訊營 AI Challenge </br> Quantum Vortex API 使用說明 </center> ## 遊戲方式 * 開啟方式 * Windows * 開啟 Anaconda Prompt,執行 `pip install pygame` * 移動到 `challenge2018` 資料夾下,並輸入 `python main.py` * Ubuntu * 開啟終端機,執行 `pip3 install pygame` * 移動到 `challenge2018` 資料夾下,並輸入 `python3 main.py` * 真人對戰 ![](https://i.imgur.com/BBXtuIt.png) * 角色操作(最多可手動控制四隻角色) * 改變移動模式: `z` / `c` / `n` / `,` * 重力塌陷  : `2` / `4` / `7` / `9` * 粒子繞射  : `3` / `5` / `8` / `0` * 高能電磁脈衝: `q` / `e` / `u` / `o` * 核分裂   : `w` / `r` / `i` / `p` * 超次元狙擊 : `a` / `d` / `j` / `l` * 激發光譜調和: `s` / `f` / `k` / `;` * 重力波共振 : `x` / `v` / `m` / `.` * 使用 AI 進行對戰 * cmd 下輸入 `python main.py "111" "222"`,即可開啟 `team_player111.py`(當成 player 0) 與 `team_player222.py` (當成 player 1) 的 AI 進行遊戲,不足四個的玩家將會以鍵盤控制補齊。 * 所有的 AI 程式碼都必須在 `AI` 這個資料夾中,檔名為 `team_playerXXX.py`,其中 XXX 為 AI 名稱 (可使用英文字母或數字,長度 10 以內為佳),AI 名稱會出現在計分板上。 * 可以使用 ``~`` 表示鍵盤控制的玩家,`_` 表示預設的 AI (`team_default.py`) e.g. `python main.py "_" "_" "~" "~"` * 跳過動畫特效 * 在打滿四位玩家的情況下,在結尾加上 `--no-cutin` 即可。 e.g. `python main.py "_" "_" "~" "~" --no-cutin` ## Helper 取得場上資訊 *** * Helper 裡面有大量函式幫助你取得場上的資訊! * 為方便 API 理解及記憶,一些專有名詞將以較簡略的名詞代替,並附有 API 中這些專有名詞的英文翻譯。 * 重力塌陷  :爆炸 / Explosion * 量子貨幣  :白球 / White Ball, wb * 脈衝波   :子彈 / Bullet * 暗物質   :子彈 / Bullet (註1) * 粒子繞射  :多重子彈 / Multibullet * 高能電磁脈衝:大子彈 / Bigbullet * 太空艙控制室:頭 / Head * 附屬量子貨幣:身體 / Body * 量子穿隧  :衝刺 / Dash * (註1) 暗物質在遊戲中歸類於無主人的子彈,意即所有玩家碰到暗物質皆會死亡。 * 若對 API 進行無意義的詢問,可能會得到 `None` 的回傳值,可用 `if var is None` 判斷 `var` 變數是否為 `None`,否則程式碼將無法運行。 *** ### 地圖相關 * `helper.getNearestGravOnRoute()` * 若行進方向上沒有重力場,回傳 None。 * 否則回傳 (center, radius),代表目前行進方向的直線路徑上,離玩家最近的重力場。 * cecnter 為 tuple (x, y) ,代表該重力場的圓心位置。 * radius 代表該重力場的半徑。 * `helper.getAllGravs()` * 回傳 list of (center, radius),代表場地上所有的重力場。 * center 為 tuple (x, y) ,代表重力場的圓心位置。 * radius 代表重力場的半徑。 * `helper.getNearestPosToCenter()` * 若玩家不在重力場內,回傳 None。 * 否則回傳 tuple,代表目前行進方向的直線路徑上,最靠近玩家身處的重力場中心的點。 * tuple 為 (x, y) ,代表該點的位置。 * `helper.getBallNumInRange(center, radius)` * center 是一個 tuple (x, y),代表某點的位置。 * radius 是一個 float,代表半徑大小。 * 回傳距離 center 小於 radius 的範圍中,場地上白球的數量。 * `helper.getOtherBulletNumInRange(center, radius)` * center 是一個 tuple (x, y),代表某點的位置。 * radius 是一個 float,代表半徑大小。 * 回傳距離 center 小於 radius 的範圍中,場地上所有子彈的數量。 * `helper.getAllBallsPos()` * 回傳 list of tuples,代表場地上所有白球的位置。 * tuple 為 (x, y) ,代表該點的位置。 * `helper.getExplosivePos()` * 回傳 list of tuples,代表場地上所有爆炸道具的位置。 * `helper.getMultibulletPos()` * 回傳 list of tuples,代表場地上所有多重子彈道具的位置。 * `helper.getBigbulletPos()` * 回傳 list of tuples,代表場地上所有大子彈道具的位置。 * `helper.canGetByExplosion(pos)` * pos 為 tuple (x, y),代表爆炸道具的位置。 * 回傳 int,代表在 pos 發動爆炸時,能吃到的白球數。 * `helper.canGetBySpin()` * 若玩家不在重力場內,回傳 None。 * 否則回傳 int,代表在目前位置進行旋轉時能吃到的白球數。 * `helper.canGetOnRoute()` * 回傳 int,代表在目前位置行進方向的直線路徑上能吃到的白球數。 * `helper.getNearestballOnRoute()` * 若玩家目前位置行進方向的直線路徑上沒有白球,回傳 None。 * 回傳 tuple (x, y),代表在目前位置行進方向的直線路徑上能吃到的最近的白球的位置。 ### 自身相關 * `helper.getMyIndex()` * 回傳 int,代表玩家編號。 * `helper.getMyHeadPos()` * 回傳 tuple (x, y),代表玩家頭的位置。 * `helper.getMyBodyPos()` * 回傳 list of tuples,代表玩家所有身體的位置。 * `helper.getMyDir()` * 回傳 tuple (x, y),代表玩家的移動單位向量。 * `helper.getMyGrav()` * 若玩家不在重力場內,回傳 None。 * 否則回傳 (center, radius),代表該重力場。 * center 為 tuple (x, y) ,代表該點的位置。 * `helper.getDashPos()` * 若玩家不是正在衝刺,回傳 None。 * 否則回傳 tuple,代表衝刺完後玩家會到達的位置。 * tuple 為 (x, y) ,代表該點的位置。 * `helper.getMyDashRemainTime()` * 回傳 int,代表離衝刺完成還有幾個 tick 的時間。 * `helper.getMyDashCoolRemainTime()` * 回傳 int,代表離衝刺冷卻完成還有幾個 tick 的時間。 * `helper.checkMeInGrav()` * 回傳 boolean,代表玩家是否處在重力場內。 * `helper.checkMeCircling()` * 回傳 boolean,代表玩家是否正在繞重力場旋轉。 * `heler.checkInvisible()` * 回傳 boolean,代表玩家是否正在衝刺。 * `helper.getMyCirclingRadius()` * 回傳 float,代表玩家正在旋轉的半徑大小。 * `helper.getMyBullet()` * 回傳 list of tuples,代表玩家所有子彈。 * tuple 為 (pos, direction, radius, speed) * pos 為 tuple (x, y),代表子彈位置。 * direction 為 tuple (x, y),代表子彈前進方向。 * radius 為 int,代表子彈大小。 * speed 為 float,代表子彈速度。 * `helper.getMyScore()` * 回傳 int,代表玩家目前的分數。 ### 其他玩家相關 * `helper.headOnRoute()` * 回傳 list of tuples,代表在玩家目前行進方向的直線路徑上所有除了自身以外活著的玩家的頭的位置。 * `helper.bodyOnRoute()` * 回傳 list of tuples,代表在玩家目前行進方向的直線路徑上所有除了自身以外活著的玩家的身體的位置。 * `helper.collisionOnRoute(pos1, radius1, _dir, pos2, radius2)` * pos1 為 tuple (x, y),代表移動的物體的位置。 * radius1 為 int,代表移動的物體的半徑。 * _dir 為 tuple (x, y),代表移動的物體的移動單位向量。 * pos2 為 tuple (x, y),代表不動的物體的位置。 * radius2 為 int,代表不動的物體的半徑。 * 回傳 boolean,代表這兩樣物體會不會相撞。 * `helper.getPlayerHeadPos(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 tuple (x, y),代表玩家頭的位置。 * `helper.getPlayerBodyPos(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 list of tuples,代表玩家所有身體的位置。 * `helper.getPlayerDir(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 tuple (x, y),代表玩家的移動單位向量。 * `helper.getPlayerDashRemainTime(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 int,代表離衝刺完成還有幾個 tick 的時間。 * `helper.getPlayerDashCoolRemainTime(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 int,代表離衝刺冷卻完成還有幾個 tick 的時間。 * `helper.checkPlayerInGrav(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 boolean,代表玩家是否處在重力場內。 * `helper.checkPlayerInvisible(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 boolean,代表玩家是否正在衝刺。 * `helper.checkPlayerCircling(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 boolean,代表玩家是否正在繞重力場旋轉。 * `helper.getPlayerCirclingRadius(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 若該玩家已經死亡,回傳 None。 * 否則回傳 float,代表玩家正在旋轉的半徑大小。 * `helper.getAllPlayerBullet()` * 回傳 list of tuples,代表所有自身以外的子彈。 * tuple 為 (index, pos, direction, radius, speed) * index 為 int,代表發射該子彈的玩家編號(若該子彈屬於暗物質,則玩家編號為-1)。 * pos 為 tuple (x, y),代表子彈位置。 * direction 為 tuple (x, y),代表子彈前進方向。 * radius 為 int,代表子彈大小。 * speed 為 float,代表子彈速度。 * `helper.getPlayerScore(player_id)` * player_id 是 int,代表想詢問的玩家編號。 * 回傳 int,代表玩家目前的分數。 * `helper.getAllBodyPos()` * 回傳 list of tuples,代表除了自身以外所有活著的玩家的身體的位置。 ### 常數相關 * `helper.explosive_radius` : 重力塌陷的爆炸範圍半徑 * `helper.head_radius` : 太空艙控制室(頭)的半徑 * `helper.body_radius` : 太空艙附屬量子貨幣(身體)的半徑 * `helper.wb_radius` : 場地上量子貨幣(白球)的半徑 * `helper.normal_speed` : 正常狀態下太空艙的移動速度 * `helper.dash_speed` : 量子穿隧(衝刺)狀態下太空艙的移動速度 * `helper.dash_cool` : 量子穿隧(衝刺)的冷卻時間 * `helper.bullet_acc` : 脈衝波(子彈)的加速度 * `helper.dash_time` : 量子穿隧(衝刺)狀態下太空艙的總耗時 * `helper.bullet_speed` : 脈衝波(子彈)的初速度 * `helper.bullet_radius` : 脈衝波(子彈)的半徑 ### 技能卡使用 在 AI 程式碼中的 `__init__` 增加 `self.skill = [1, 1, 1, 1, 1, 1, 1]`,數字代表有幾張技能卡,`self.skill`中的第 0 ~ 6 項分別對應到 * 重力塌陷(爆炸) * 粒子繞射(多重子彈) * 高能電磁脈衝(大子彈) * 核分裂 * 超次元狙擊 * 激發光譜調和 * 重力波共振 ### AI 回傳值 * `AI_NothingToDo` : 不做任何動作 * `AI_MoveWayChange` : 改變移動方式 * `AI_Explosion` : 使用技能卡-重力塌陷(爆炸) * `AI_MultiBullet` : 使用技能卡-粒子繞射(多重子彈) * `AI_BigBullet` : 使用技能卡-高能電磁脈衝(大子彈) * `AI_NuclFission` : 使用技能卡-核分裂 * `AI_HypSniping` : 使用技能卡-超次元狙擊 * `AI_ExSpecHarmony` : 使用技能卡-激發光譜調和 * `AI_GravResonance` : 使用技能卡-重力波共振

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