logotransparent.png

Legion of Learners

www.lol-101.com

  • Home

  • Classrooms

  • Courses

  • About Us

    • Executive Team
    • Board Members
  • Resources

  • More

    Use tab to navigate through the menu items.
    To see this working, head to your live site.
    • Categories
    • All Posts
    • My Posts
    sfolax6776
    Dec 06, 2019
      ·  Edited: Dec 06, 2019

    5.12.2 Project P6.7 - How far can a drunkard move?

    in Introduction to Java

    A Introduction

    A drunkard in a grid of streets randomly picks one of four directions and stumbles to the next intersection, then again randomly picks one of four directions, and so on. You might think that on average the drunkard doesn’t move very far because the choices cancel each other out, but that is not the case.
    
    

    B Your task:

    Represent locations as integer pairs (x, y). Implement the drunkard’s walk over 100

    intersections, starting at (0, 0), and print the ending location.

    0 comments
    0
    0 comments

    Questions? Email us at legionoflearners@gmail.com or join our WeChat group!

    • lol-101dotcom

    ©2020 Legion of Learners