AUTHOR

ok seriously, need C++ help. do you know what to d

yaafi quote:
so basically if path_start = array[0>[0>
position = 1

if path_start = array[max>[0>
position = 3

else position = 2


???
no...that would be wrong

i don't want it to equal the number IN the array. I want it to equal the row so..

path_start = 0 then position = 1
yeah....
yaafi quote:
so basically if path_start = array[0>[0>
position = 1

if path_start = array[max>[0>
position = 3

else position = 2


???
or something like

if (array[index> - 1 > 0) && (array[index> + 1 < max) then middle
else if array[index> - 1 == 0 then top
else bottom

-This message has been edited by ChrisAGunz on 12/9/2010 4:50:50 PM

-This message has been edited by ChrisAGunz on 12/9/2010 4:51:10 PM

ChrisAGunz quote:
or something like

if (array[index> - 1 > 0) && (array[index> + 1 < max) then middle
else if array[index> - 1 == 0 then top
else bottom
-This message has been edited by ChrisAGunz on 12/9/2010 4:50:50 PM

-This message has been edited by ChrisAGunz on 12/9/2010 4:51:10 PM


you can do two else statements?
Do you have to move at all, tbh?

I mean could you just move to the same position?
yaafi quote:
you can do two else statements?
if, else if, and else
yaafi quote:
you can do two else statements?
yeah, it's structured like:

if (condition) {
statement
}
else if (condition) {
statement
}
else {
statement
}
FriendZone quote:
Do you have to move at all, tbh?

I mean could you just move to the same position?
yeah...but we're trying to "trailblaze". So technically I could..but


ThetrailblazeFunction [4points>
This function finds a path from the left-most column of a 2d array to the right- most column. A path is just a list of adjacent cells. The first parameter indicates which row of the left-most column to start the path at. The second parameter is the 2d array, and the third parameter is a two-element array that indicates the number of rows and columns in the array. The fourth parameter is the kind of path to find, either random or lowest.
This function must keep track of the current position (row and column). The start- ing row is given as a parameter, and the starting column is always 0 (the left-most column).
The function then repeats the following four steps until the current position ends up in the right-most column:
1. Printoutthecurrentposition, 2. Putourspecial“path”value-1inthecurrentpositioninthe2darray, 3. Decidewhichdirectiontogo(eitherup-right,down-right,orright), 4. Updatethecurrentposition.
To decide which direction to go, this function calls one of the find functions, de- pending upon whether the path should be random or lowest:
i'm going to have so many goddamned nested loops. fuck.
seems like you're going to need min/max for top, left, right and bottom based on the size of your 2D array (which can be dynamically read but tricky to do--not sure how)

and now i realize the random 1~3 is just a position move so if you're at the top you can't move up and to the right, you can only move right or down and to the right.

so yeah, you'll have fun with this one.
dog send me your nudes and i'll do your program for you
L0custSlayER quote:
dog send me your nudes and i'll do your program for you
(which is only what women are good for because you clearly don't understand programming logic dog)
yaafi quote:
What would the algorithm look like for this:

Thefind_random_directionFunction [3points> This function has 1 parameter. This parameter should equal 1 if you are currently
on the top row, 2 if you are on the middle row, and 3 if you are on the bottom row.
It returns either 1, 2, or 3, to indicate a move in the up-right, down-right, or right direction, respectively. The choice between the 3 possibilities is random, but only a valid move should be returned.
int find_random_direction(int row) {

srand((unsigned)time(0));

if (row == 1)
return (rand() % 2 + 2);
if (row == 2)
return (rand() % 3 + 1);
if (row == 3)
return (rand() % 2 + 1);
}
dog you owe me some fucking nudes

void trailblaze(int startrow, object[>[> arr, int[> size, string pathtype) {

int currx, curry, move, rowtype;

currx = 0;
curry = startrow;

cout << currx + ", " + curry << endl;
arr[currx>[curry> = special "path" value;

while(currx < size[1>) {

if (curry == 0)
rowtype = 1;
else if (curry == size[0> - 1)
rowtype = 3;
else
rowtype = 2;

if (pathtype == "lowest"Smiley
move = find_lowest_direction(rowtype);
else
move = find_random_direction(rowtype);

if (move == 1)
curry++;
if (move == 2)
currx++;
if (move == 3)
curry--;

cout << currx + ", " + curry << endl;
arr[currx>[curry> = special "path" value;

if (currx == size[1> - 1)
currx++;
}


}

Quick reply

Sign in to post a message.
Smileys

Times shown in Eastern Time (ET).