Questions tagged [move]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

Move function do not working

I cant understend why, but my move function does not work properly. It looks correct to y mind. But no Can you please chck what's wrong? bool move(int tile) { if(tile > d*d-1 || tile <= 0) ...
0
votes
1answer
131 views

Game Of Fifteen Moving

Ok, so I took some tips from another post I made and I have improved my code, but I still cannot swap my tiles. Also, it appears that all tile moves are legal and none of them print "illegal" even ...
0
votes
0answers
56 views

pset3 Game of fifteen -make

it is not swapping the values but instead copying it ...pls someone tell me where the problem lies in my code... //move function bool move(int tile) { void swap(int *a,int *b); //check the ...
0
votes
1answer
41 views

Help with the move function pset3 game of fifteen

I've been stuck on the move function for a really long time and I can just not figure out how to do it. I've tried to get help from other people and I really just don't understand any of it. Please ...
0
votes
1answer
39 views

PSET3- Game of fifteen, function move();

So, my move function is ALMOST working, but sometimes when swaping numbers both tile AND blank space shows up as a blank space...can you guys check my code? Thanks! Ps..Blank is a global variable, ...
0
votes
1answer
56 views

PSET3 'Illegal Move" coming up for legal moves as well! Almost done!

I have finished with Pset3 except for a tiny little bug. every move is somehow an Illegal Move. here's my code. bool move(int tile) { // TODO // find location of specified tile using linear search ...
1
vote
1answer
45 views

ps3 Move, check50, illegal move are moving? help please

Please, I spent so many hours on this and I can't find the mistake I am doing. From the start, there are some numbers still move when they are illegal move. See description from check50: :( 3x3 ...
0
votes
1answer
65 views

Pset3 Move Function “Illegal Move”

my code is notifying me with "Illegal Move" every time I test it. I was wondering if someone can help figure out what is wrong with my code? bool move(int tile) { // TODO int i, j; int swap; //rows ...
0
votes
1answer
83 views

Fifteen - help please, I can't find the problem in my code for move and won

I'm still at the first move to understand what is going wrong. If my first tile to move is the number work, it does work, so 3 and - swap, but the game show me ftw! ??? and when I move for the first ...
0
votes
1answer
35 views

The tile doesnt swap or move when i use this code!

I have been stuck on this for two days now. Would really appreciate some fast help! every time i run this it and put in Tile to move:3 all the numbers on the board change can u give me ideas on how to ...
0
votes
1answer
36 views

Pset3 - Fifteen - Move() Accepts Legal Moves, but does not swap?

I have been able to successfully draw the board with the correct configuration, but when I try to implement move(), I cannot get the values of tile to swap with the blank space. As it currently stands,...
0
votes
2answers
29 views

Fifteen.c/PSTE3 MOVE FUNCTION NOT SHOWING EXPECTED OUTPUT

Though my program fifteen.c/pset3 compiles with the int,draw,move function but the tiles are not moving at all. Here's my code as well the output.Kindly check and any suggestions will be appreciated. ...
0
votes
1answer
54 views

Game of fifteen move function duplicating “_”

My move function is duplicating the blank tiles instead of swapping. I even checked for the boundary conditions. It swaps immediate left and right ones, but the ones on top and beyond (illegal move) ...
0
votes
1answer
63 views

“Expected Expression” Error on Move Function

I am having a problem compiling fifteen.c. When I try to compile, I get an error in the move function saying: fifteen.c:225:27: error: expected expression coord_t = {i, j}; ...
1
vote
1answer
42 views

Game of Fifteen Not Swapping Tiles and Allowing Illegal Movies

I have two issues with my code. First, while the code correctly moves the underscore to the new space, it does not move the tile to the space where the underscore once was. So I end up with a bunch of ...
0
votes
1answer
95 views

Pset3 (Game of Fifteen): The tiles won't swap… (“Illegal move”)

I have an issue with my code in Game of Fifteen. I get "illegal move" when I try to swap the tiles, even if it's a "legal" tile. I tried everything but I really don't understand what's wrong. Does ...
1
vote
1answer
27 views

PSET 3 can't get move to swap tile above blank

Keep getting illegal move on following code and can't figure out why it won't swap. I am selecting the tile above the blank in testing. /** * Prints the board in its current state. */ void draw(...
0
votes
1answer
50 views

Game of Fifteen - Move Function - getting wrong coordinates?

I have been working on the game of fifteen problem and seem to be having an issue. I keep getting an "Illegal Move" when it is a legal move. I think I have found part of the issue and I would just ...
0
votes
1answer
55 views

Pset3 Fifteen: “move” moves only once

My "move" function lets me make one move. After that, anything I do is illegal. This is my code: bool move(int tile) { int a = d - 1; int b = d - 1; for (int i = 0; i < d; i++) { for (int j ...
0
votes
1answer
23 views

where to initialize the variable that keeps track of the blank space

I am working on "Move" of exercise Fifteen in PSET3 of CS50. I am unsure about how to keep track of the blank space. I have tried to add the row and column number of the initial blank space as a ...
0
votes
1answer
37 views

cs50 pset3 move

I have been changing and trying a bunch of stuff but it won't work. Could any of you see what is wrong with my code? I already have read a lot of answers for the same function but I still can't find ...
0
votes
2answers
104 views

Move function on pset3

Can anyone explain to me what is asked from us in move function regarding pset3? I've finished init and draw, it compiles and prints on terminal exactly as it should. But I don't know what is my task ...
1
vote
1answer
41 views

pset3 fifteen what am I doing wrong with my move function

I have been working on the move function for fifteen for a few days and I don't understand where I am going wrong, please can someone advise me where/what I should focus on. Here is my code: /** * ...
0
votes
2answers
130 views

pset3: Help with Fifteen Move function

I need help with my move function. I can't figure out how to store the blank tile position only once without searching it together with the TILE input. Also, my move based on this code is always ...
0
votes
1answer
89 views

Move (fifteen )

Can anyone help me point out the mistake I've made? The underscore just moved so wrong that I can't find the pattern.
0
votes
2answers
20 views

pset 3 move function '“ \ expected an exit code of 0, not a prompt for input”

Everything passes the checkcs50, except for the move function. I don't know what I'm doing wrong. bool won(void) { int i, j; for(i=0; i<d; i++) { for(j=0; i<d; j++) { if ( ...
0
votes
0answers
91 views

pset3 move function

I have been banging my head against a wall for the last few days trying to figure out the move function. January 1st is fast approaching and I want to finish this pset and submit it before they ...
0
votes
1answer
40 views

pset3 move uses the wrong Blankspace value

Hello in my move function for fifteen, when it searches for an adjacent blank space, if the tile is on the edge and the "missing" adjacent spot happens to be before my correct spot in the code, it use ...
0
votes
1answer
33 views

What is wrong with move function?

bool move(int tile) { if(tile > d*d || tile <1) return false; int blank; for(int i=0; i<d; i++) { for(int j=0; j<d; j++) { if(board[i][j] == 0) //0 is the value for ...
0
votes
1answer
166 views

Game of fifteen: everything works perfect until winning move breaks game

I've gotten pretty much everything working in fifteen. The tiles move correctly, the redraw works with a board of any size, et cetera. So I pasted in the ./fifteen 3 < ~cs50/pset3/3x3.txt the pset ...
1
vote
1answer
64 views

Pset3 Move GDB Problem

I am stuck on the move part of fifteen and trying to learn how to use GDB. My thought process for moving is to search for the "tile" and if the tile is adjacent to the "_" then switch. during GDB, i ...
0
votes
1answer
65 views

pset3, move function !! Please Help?

This code swaps digits but when i enter illegal key instead of illegal key prompt it replaces that digit with 0. bool move(int tile) { int blank; for(int i=0; i<d; i++) { for(...
0
votes
1answer
39 views

My program returns false even when I input a correct value for tile

void init(void) { int gridsize = d * d; for (int i = 0; i < d; i++) { for (int j = 0; j < d; j++) { board[i][j] = gridsize - 1; gridsize--; ...
1
vote
2answers
263 views

PSET3 Game of Fifteen move() Problem

I'm sorry for making another post of this, but I don't want to look other classmates' code while I'm still trying to do this myself. I'm having trouble with move() in fifteen.c. I'm not sure how to ...
0
votes
1answer
42 views

pset3 move: won't move tiles in the same row

So I have reviewed similar questions on here but can't quit fix my move code. It will correctly move tiles from within one column to row below (say 3 in the initial position for a 3x3 board). But it ...
0
votes
1answer
395 views

Pset3/fifteen: move

I think some of the move code I've written is working correctly in that once the "Tile to move:" message appears and I enter a logical tile to move, I do not see the "illegal move" message, but when I ...
0
votes
1answer
64 views

Problem with move(), pset3

I have problem with the move function from pset3, CS50. I think that the problem is in the corner tiles but I can't solve it. Thanks in advance! /** * If tile borders empty space, moves tile and ...
0
votes
1answer
100 views

pset 3 fifteen move() function; same code but works for left move and up move, not right and down

Here is my code /** * fifteen.c * * Computer Science 50 * Problem Set 3 * * Implements Game of Fifteen (generalized to d x d). * * Usage: fifteen d * * whereby the board's dimensions ...
0
votes
1answer
44 views

Fifteen.C Move Function Fails One Check50 Test

I've been working on fifteen.c for a little bit now. Move works just fine except it fails on one of the check50 tests - move up-up-left-down-down-left-up-up-right-down-down-right test. Is there an ...
0
votes
1answer
114 views

Pset3 fifteen - move: Tiles wont switch, “illegal move” error even when valid

I have been trying to get the tiles of the move function to switch if any adjacent cells are blank. The initiation and draw functions work fine, I just need to get the move function to make the actual ...
0
votes
1answer
64 views

Pset3, move function doesn't compile

I have a problem with compiling a fifteen.c. I've made init and draw functions with good result, they compile and work as they should, but when I moved forward I have some kind of bug with move ...
1
vote
1answer
111 views

pset3: problem with move function and board printing

I am stuck on the move function in Pset3 Fifteen. My code correctly identifies legal and illegal moves, but does not update the board. I tried calling draw() into my function for legal moves (but I ...
0
votes
2answers
384 views

pset3: fifteen - problem with “move” function

I've been trying to figure out the "move" function for a whole day and I can't pass this problem. When I try to move an element that is in a different line everything is fine but when I try to move an ...
0
votes
0answers
30 views

MOVE FUNCTION WORKS WHEN MOVING ALONG I BUT NOT J

I have been working on this one for a bit. I think I am close to having it work correctly. I have run into an issue where I can move tiles along the i but not the j. See below Move Function: bool ...
0
votes
3answers
47 views

move in pset3 fifteen not working properly

My move() function is not working properly when making a move, the outcome is: 8 7 6 5 4 3 2 _ _ My code is as follows: bool move(int tile) { if (tile > d*d - 1 || tile < 1) { ...
0
votes
1answer
54 views

Fifteen move not working in last row only

I am very new to this, so I am at a loss as to why my code isn't working. I am trying to make my move function work in the game of fifteen, and it works as long as I am not going to the left or right ...
0
votes
2answers
47 views

Pset3 - move function - Keep getting an “Initialize the variable” message

bool move(int tile) { int xaxis = d - 1; int yaxis = d - 1; int tile_i; int tile_j; search_the_board(tile); if (tile_i == xaxis + 1 || tile_i == xaxis - 1) if (tile_j == ...
0
votes
1answer
47 views

Pset 3 Move: sometimes calling legal moves illegal

I have been working on this forever and cannot find the problem. My move function works ALMOST always. I have no idea why, but sometimes it calls legal moves illegal. Thanks in advance! (my brain is ...
0
votes
1answer
36 views

Pset 3: Move- seemingly random blank spaces

My move function sometimes works but sometimes doesn't. I know that the problem is because i and j are going out of the range they should be in. All help is appreciated! bool move(int tile) { int ...
0
votes
1answer
82 views

pset3 - Game of Fifteen can move in basic directions, but not in combinations of moves

My Game of Fifteen seems to work when I try to move in the four basic cardinal directions, but when I use check50, the game seems to brake in unexpected places (such as after several moves). For ...