Thread: Help - Walk in a bidimensional array

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by juanjuanjuan View Post
    Sorry, I didn't understand everything. You say that, in a for, I have to write 2 if.
    If (continue with the steps)
    If (stop because I finish the "square")

    Are you saying that? I'm trying to write a program that says that but I can't
    You can use either a for or a while or a do while loop. They all can be made to work in place of the other. I like the for loop for this one.

    You turn right on square one, and enter the loop.
    Code:
    start the loop: (stop the loop when you have no more empty squares) {
       You walk straight ahead. 
       (either the end of the array has been reached, or the square in front of you has a "been visited" value in it)
        If (you can't walk in that direction any more, && you have an empty square on your right)
           You turn right
    }
    Give it some work, Juan!

    Isn't that a thing of simple "noir" genre beauty?
    Last edited by Adak; 02-14-2014 at 11:42 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help - Bidimensional array
    By juanjuanjuan in forum C Programming
    Replies: 17
    Last Post: 02-14-2014, 08:43 PM
  2. problem with pointers and bidimensional arrays
    By Gustaff in forum C Programming
    Replies: 4
    Last Post: 02-07-2013, 12:42 AM
  3. Program that generates a "random walk" across 10*10 array
    By danieldcc in forum C Programming
    Replies: 37
    Last Post: 07-23-2011, 01:19 AM
  4. 4 questions about bidimensional table
    By Dan. in forum C++ Programming
    Replies: 2
    Last Post: 02-14-2011, 11:18 AM
  5. create and populate create bidimensional array
    By darkducke in forum C Programming
    Replies: 0
    Last Post: 12-03-2010, 07:06 AM