1 / 18

PACMAN on Mobile

PACMAN on Mobile. Agenda. TOOL RULE Environment PLAY AI Thinking Q & A. TOOL. ภาษาที่ใช้ในการพัฒนา : Java 2 Mobile Edition ( J2ME ) Tool ที่ใช้ในการพัฒนา : NetBeans 3.6. RULE. Pacman สามารถเดินได้ตามช่องทางที่มีไว้ Pacman สามารถกินยาจุดเล็กเพื่อเก็บคะแนน ผีจะสามารถกิน Pacman ได้

pink
Download Presentation

PACMAN on Mobile

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PACMAN on Mobile

  2. Agenda • TOOL • RULE • Environment • PLAY • AI Thinking • Q & A

  3. TOOL • ภาษาที่ใช้ในการพัฒนา : Java 2 Mobile Edition ( J2ME ) • Tool ที่ใช้ในการพัฒนา : NetBeans 3.6

  4. RULE • Pacman สามารถเดินได้ตามช่องทางที่มีไว้ • Pacman สามารถกินยาจุดเล็กเพื่อเก็บคะแนน • ผีจะสามารถกิน Pacman ได้ • เมื่อ Pacman กินยาเม็ดใหญ่แล้วจะสามารถกินผีได้ซึ่งจะคงสภาพได้ 6 วินาที • เมื่อ Pacman กินยาจุดเล็กหมดจึงจะผ่านด่าน

  5. PEAS • Performance เคลื่อนที่เข้าใกล้ Pacman ให้มากที่สุด • Environment CPU มือถือ , หน่วยความจำ , หน้าจอมือถือ , ปุ่มกด , Joy Stick • Actuators สามารถเคลื่อนที่ตามทิศทางต่างๆ และกิน pacman • Sensors ปุ่มกดบนโทรศัพท์มือถือ

  6. Environment Types • Fully Observable สามารถเข้าถึงได้ทุก state ของ Environment • Deterministic สามารถรู้ล่วงหน้าว่า Pacman จะอยู่จุดใด • Episodic การทำงานนี้สามารถแบ่งเป็นตอนๆได้ เช่น เมื่อ Pacman กินยาแล้วสามารถคงสภาวะอมตะได้ 6 วินาที • Static ระบบคงที่สามารถเข้าใจได้ทุกสถานะ • Discrete สามารถ Define แต่ละ state ได้อย่างชัดเจนในทุกๆการเคลื่อนที่ • Multi-agent มี Agent หลายตัว

  7. PLAY • เมื่อเริ่มเกมส์จะมี Menu ดังกล่าวให้เลือก New Game เพื่อเริ่มเกมส์ใหม่

  8. PLAY • เมื่อเริ่มเกมส์สามารถเริ่มเล่นได้ทันทีโดยใช้ลูกศร เพื่อเคลื่อนตัว Pacman

  9. PLAY • เมื่อ Pacman กินยาเม็ดใหญ่จะสามารถกินผีได้ซึ่งสามารถคงสภาพได้ 6 วินาที

  10. A.I. Thinking เมื่อ pacman เคลื่อนที่ ghost จะจับทิศทางที่ pacman ไป

  11. A.I. Thinking ghost จะพยายามเคลื่อนที่เข้าใกล้ pacman ให้ได้มากที่สุด

  12. A.I. Thinking เมื่อ ghost เคลื่อนที่ไปเจอกับเส้นกั้น ghost ก็จะหาทิศทางอื่นโดยสอดคล้องกับทิศทางที่จะเข้าใกล้ pacman ให้ได้มากที่สุด

  13. A.I. Thinking เมื่อ ghost พบช่องทางที่จะเคลื่อนที่ไปในทิศเดียวกับ pacman, ghost ก็จะไปตามเส้นทางนั้นอีกครั้ง

  14. A.I. Thinking if (Math.abs(pacX) > Math.abs(pacY)) { if (pacX > 0) moveTowards(RIGHT,UP,DOWN,LEFT); else moveTowards(LEFT,DOWN,UP,RIGHT); } else { if (pacY > 0) moveTowards(DOWN,LEFT,RIGHT,DOWN); else moveTowards(UP,RIGHT,LEFT,UP); }

  15. A.I. Thinking private void moveTowards(int i1, int i2, int i3, int i4) { if (runFromPac_) { if ( goInDirection(i4) ) return; if ( goInDirection(i3) ) return; if ( goInDirection(i2) ) return; if ( goInDirection(i1) ) return; } else { if ( goInDirection(i1) ) return; if ( goInDirection(i2) ) return; if ( goInDirection(i3) ) return; if ( goInDirection(i4) ) return; } }

  16. A.I. Thinking private boolean goInDirection(int d) { if (d == LEFT) return goToNode(myNode_.getLeft()); if (d == RIGHT) return goToNode(myNode_.getRight()); if (d == UP) return goToNode(myNode_.getUp()); if (d == DOWN) return goToNode(myNode_.getDown()); return false; }

  17. A.I. Thinking private boolean goToNode(GridNode n) { if (n == null) return false; myNode_ = n; newPixelX_ = myNode_.pixelCenterX(); newPixelY_ = myNode_.pixelCenterY(); return true; }

  18. Question & Answer

More Related