Thread: Help! Robot Programming

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak
    You're NOT a Sokoban player!!
    You're the only one saying anything about Sokoban. Not the OP. I don't care about what you want to do with the program. You're not the one with the post. If you want to write a Sokoban robot, go ahead, but get out of this thread, because that's not what they're doing.
    Quote Originally Posted by Adak
    You can work DIRECTLY with the input from the user, and every movement is relative to the current position of the robot, of course.
    So what's your point? No, you don't have to use compass directions, but it's easy to think that way. It's also easy to program it that way. No, you don't need to name your directions, but it's easier to do so.


    Quote Originally Posted by Adak
    Perhaps I'm too compass oriented, but on my screen, West is on my right hand side, but using these robot directions, West would have to be East, and of course, East would have to be West.

    That doesn't HELP!

    Adak
    If your monitor is a map, then North is always at the top.

    Quzah.
    Hope is the first step on the road to disappointment.

  2. #17
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    My point is that when you can use the user's input directly, it makes it easier to program if you do use it. I'm not saying he has to do it that way.

    His assignment is a simplified version of Sokoban.

    I worked with maps for about 15 years. I believe I know which way is North.

    Adak

  3. #18
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak
    My point is that when you can use the user's input directly, it makes it easier to program if you do use it.
    No it doesn't. You still have to reference the heading. Oh, heading by way of definition relates to a compass:
    head‧ing [hed-ing] Pronunciation Key - Show IPA Pronunciation
    –noun 1. something that serves as a head, top, or front.
    2. a title or caption of a page, chapter, etc.
    3. a section of the subject of a discourse; a main division of a topic or theme.
    4. the compass direction toward which a traveler or vehicle is or should be moving; course.
    5. an active underground mining excavation in the earth, as a drift or raise being or about to be driven.
    6. Aeronautics. the angle between the axis from front to rear of an aircraft and some reference line, as magnetic north.
    But since you've got so much map experience, I expect you know that already. *snicker*

    But back on topic, you're telling the robot to do one of four things. Not "go north", but rather "turn right", move foreward, etc. You still have to figure out what, with comparison to your grid (that's the array; oh, and I have 25 years experience with graph paper ... now I'm just mocking you, in case you're not catching on to the fact) do you need to do. Do you need to figure out what axis gets incremented or decremented. Compass points work nicely for this.

    But hey, if you think you can do better, then do so. And I'll wager you still end up using compass points, even if you choose not to call them "NORTH".


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #19
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Not really. the robot only travels, forward. So my MakeMove functions uses int's for Up, Down, Left, and Right directions, only.

    Seems natural and simple to me, so of course, I recommend it. The OP can use it or perhaps contrast that with his own code, and compare the strengths and weaknesses of both styles.

    Good luck with your mocking routine. I'm sure it helps lots of posters, and earns the respect and friendship of others.

    Adak

  5. #20
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak
    Not really. the robot only travels, forward. So my MakeMove functions uses int's for Up, Down, Left, and Right directions, only.
    Up - North, Down - South ... Like I said, you may not call them "North", but you are using the same thing. To prove it, you are facing "down". Turn left. I am facing south. Turn left. It's the same exact thing.

    To further the point, yours is less intuitive, in that, the instructions say "turn left", "turn right". They don't say "face left" or "face right", because then you'd need "face up" and "face down".

    And finally, you still have to caluculate the turn. What makes more sense:

    Facing west, turn left.

    Facing left, turn left.

    You don't face left. You face a compass direction. You turn left, or you turn right. You don't face left or face right.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #21
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Let's agree that we disagree.

    I've done more left face, right face, and about face turns than you can ever imagine.

    "Civilians "

    I like the way my makemove function is written, and won't change it to suit your idea's.

    One problem I had with the description was the lack of a fixed shape or size to the boxes on the grid.

    My makemove function does NOT handle (currently), grid positions where one box might push against just a part of another box on the grid. e.g.:

    Code:
    X X X X X X X X X X X X X X X X X
    X 0 0 B 0 0 0 0 0 0 0 0 0 0 0 0 X
    X 0 0 B B B B B 0 0 0 0 0 0 0 0 X
    X 0 0 0 0 B B 0 0 0 0 0 0 0 0 0 X
    X 0 0 0 0 B 0 A A A A A A 0 0 0 X
    X 0 0 0 0 0 0 0 0 0 ^ 0 0 0 0 0 X
    X X X X X X X X X X X X X X X X X
    The 'B' on the second row is resting against the wall on the first row. My makemove will not detect that, currently.

    Did your instructor or book have something in mind to handle this situation? Obviously there is logic that could be used to handle this, but it seems a bit much for a Sept. assignment.

    Let me know.

    Adak

  7. #22
    Registered User
    Join Date
    Sep 2006
    Posts
    4
    My robot can move forward and move ONE package!! ^^ IF statements FTW!!

  8. #23
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak
    You're NOT a Sokoban player!!
    Quote Originally Posted by Adak
    I've done more left face, right face, and about face turns than you can ever imagine.
    Obviously you've never met an ostrich.


    Quzah.
    Hope is the first step on the road to disappointment.

  9. #24
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Gizzle,

    Dialog's with irritants in the middle just take the fun out of forums for me. Good luck with your program, and thanks for reminding me of a fun little puzzle to code up.

    Adak

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Continuous Navigation while X for a Robot
    By Creighton in forum C Programming
    Replies: 3
    Last Post: 06-29-2009, 08:38 PM
  2. New Problem with the Robot output!
    By tx1988 in forum C++ Programming
    Replies: 0
    Last Post: 04-18-2009, 04:02 PM
  3. Generate keypresses like the Robot class in java
    By samel_tvom in forum Game Programming
    Replies: 3
    Last Post: 10-06-2008, 05:37 AM
  4. Help with moving robot in a maze
    By Killahkode in forum C Programming
    Replies: 2
    Last Post: 09-25-2006, 10:51 AM
  5. Replies: 5
    Last Post: 09-08-2001, 09:18 AM