Questions tagged [pset3]

The problem set for Week 3 asks students to write code for a classic puzzle game in the C programming language.

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

Pset 3 - find.c is not working

I have compiled find.c, generate.c and helpers.c. When I compile make all, I get the following error message: jharvard@appliance (~/Dropbox/pset3/find): make all clang -ggdb3 -O0 -std=c99 -Wall -...
3
votes
3answers
416 views

Blank tile without using a variable

Regarding the blank tile in Game of Fifteen, can I avoid using a variable for the blank? In other words, can I just print an underscore when I reach zero in my array?
1
vote
2answers
98 views

Do we have to implement game of fifteen in pset3 using graphics?

Does fifteen.c had to be implemented in graphics, by including graphics.h and creating the tiles as graphical objects?
0
votes
2answers
246 views

pset3 fifteen move doesn't compile

First of all I know there are two questions very similar to this one but the answer I'm looking for is not there. I'm working on my "move" function for fifteen in pset 3. I keep getting the "control ...
0
votes
1answer
106 views

What is if(!move(tile)) and can I change it?

I don't understand the if(!move(tile)) condition in pset3. Can anyone please explain it to me? Can I change this code?
0
votes
1answer
467 views

pset 3 “control may reach the end of a non-void function” [duplicate]

I know what this error means, but how do I fix it? I'm using a if... else... function, so I'm not sure how to improve upon that. Thanks!
-1
votes
1answer
303 views

pset3 won - segmentation fault?

I've tried a solution for function won but I always get segmentation fault (core dump). First for loop is row It doesn't work... always this segmentation fault.... what am I doing wrong? please help!
1
vote
2answers
28k views

How do I fix a “use of undeclared identifier” compilation error?

In the following code snippet: for (int column = 0; column < d - 1; column++); { board[&row][&column] == counter; counter++; make returns the following error: fifteen.c:140:19: ...
1
vote
1answer
274 views

won() Doesn't Work Properly

My won() function works properly when the board dimensions are 3 x 3. However, it doesn't work properly when the board dimensions are 4 x 4. What could possibly be wrong? for (int i = 0; i < d; i++...
1
vote
2answers
99 views

The Case of the Disappearing Tiles

I just finished trying to implement my move function. It seems to work to a certain extent, except that some of the tiles keep turning into blanks. I have the following code for my swapping: for (int ...
0
votes
1answer
252 views

My sort and search functions don't work for find.c - look at my code?

I try inputting ./find 31 and then the list 30, 31, 32 and it still says it can't find the needle in the haystack. :( I don't know if it's my search function, my sort function, or both. Help! The ...
0
votes
1answer
108 views

Dereferencing 2d pointer to print board

I've used pointers to help create my game of fifteen grid, and now I want to print out the board using 'draw'. The function works to the point that the board prints, but instead of array elements I ...
0
votes
1answer
525 views

helpers.c is not sorting my array and I'm running low on ideas on how to fix it

My first question on this board and I really need some help in order to figure out what could be wrong with my code. I decided to go with a a selection sort but as soon as I run ./generate 2 2 in ...
0
votes
2answers
119 views

GDB stops at GetInt()

I tried using GDB for my Game of Fifteen but I can't get to the part of functions move and won because GDB stops when command line asks for tile to move. This has something to do with GetInt. GDB ...
0
votes
2answers
72 views

How to define something in a loop only once and have it remain after function ends and is called again?

for pset3 my move function is the following: int j = 0; for(int i = 0; j < d; i++) { if(i == d) { i = 0; j++; } if(board[i][j] == tile) { printf("%i, %i", i, j); ...
1
vote
4answers
132 views

Pset3: why are the j and i values not swapping?

Here is my code: for(int i = 1; i < n - 1; i++) { printf("%i\n %i\n", i, j); int j = i + 1; if(values[j] < values[i]) { int tmp = j; j = i; i = ...
1
vote
2answers
1k views

Pset3 Fifteen Move function

I dont even know how to begin the move function, can somebody give me some ideas please? Probably by searching the tiles position, but how can i do that?
2
votes
1answer
2k views

why do we pass arguments to the main function?

I did not understand that ,why do we pass arguments to the main function? for example in pset3 generate.c main {int argc,string argv[]}. please explain?

1
22 23 24 25
26