×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

please help me in this program

please help me in this program

please help me in this program

(OP)

i ve got a problem with this program, is about a robot which can move one position right (MR) in a 4x4 table. movements left(ML) down(MD) or up(MU) are not allowed.The pr_move is the position that came from, move is the position tha we want to go right(MR).x is the row that is the row and y is the coloumn. it cant move diagonial. Iwant the function to  have 2 arguments , the first is the move that i would like to move(MR, ML,MU) and the second is a list. The list has 3  atoms the first is the previous move (pr_move) that came from, the second is x the row the third is y the coloumn.
the below code has problems it cant runs.. if someone could help me i woul appreciate it.

(defun move_robot (move  '(pr_move x y))
  (cond ((eq move 'ML)  'NO_MOVE)
    ((eq move 'MU)  'NO_MOVE)
    ((eq move 'MD)  'NO_MOVE)
    ((eq move 'MR) (princ (list pr_move x (+ y 1))))
               

)
)


(move_robot (read) '((read) (read) (read)))

RE: please help me in this program

I don't understand right, what the function should do, but this works:

mv.lsp

CODE

(defun move_robot (move pr_move x y)
  (cond ((eq move 'ML)  (princ 'NO_MOVE))
        ((eq move 'MU)  (princ 'NO_MOVE))
        ((eq move 'MD)  (princ 'NO_MOVE))
        ((eq move 'MR)  (princ (list pr_move x (+ y 1))))))

(move_robot 'MR 'STARTING_POINT 1 3)
The output is:

CODE

$clisp mv.lsp
(STARTING_POINT 1 4)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close