TAILIEUCHUNG - Recent Advances in Mechatronics - Ryszard Jabonski et al (Eds) Episode 1 Part 4

Tham khảo tài liệu 'recent advances in mechatronics - ryszard jabonski et al (eds) episode 1 part 4', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 104 T. Marada 3. Maze storing One of the more useful properties of the maze is its size. For a full sized maze we would have 16 rows by 16 columns 256 cell values. Therefore we would need 256 bytes to store the distance values for a complete maze. A single byte can be used to indicate the presence or absence of a wall in the maze. The first 4 bits can represent the walls. A typical cell byte can look like this Bit No. 7 6 5 4 3 2 1 0 Wall W S E N When we are using the binary bit value for each wall position we have North 1 East 2 South 4 and West 8. Now any combination of walls in a cell can be represented by a number in the range 0 to 15. For example if some cell have wall on the West and on the East then this cell can be represent by value 10 which is 0x0A in hex or 00001010 in binary. Figure 3 Example of maze storing Every interior wall is shared by two cells so when we update the wall value for one cell then we have to update the wall value for its neighbor too. 4. The Flood-fill algorithm The idea of flood-fill algorithm is to start at the goal centre of the maze and fill the maze with values which represent the distance from each cell to the goal. When the flooding reaches the starting cell then we can stop and follow the values downhill to the goal. In the figure 4 we can see the sequence of the maze being flooded. This maze is completely mapped and we know where all walls are. We can clearly see how dead ends are handled and what happens when there is more than one way through maze. The robot for practical verifying of artificial intelligence methods Micro-mouse task 105 Figure 4 Sequence of the maze being flooded For a full sized maze we would have 16 rows by 16 columns 256 cell values. Therefore we would need 256 bytes to store the distance values for a complete maze. Because the micro-mouse can t move diagonally the values for a 5x5 maze without walls would look like this Figure 5 Flood-Fill example without walls When it comes time to make a move the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.