Questions tagged [won]
The won tag has no usage guidance.
10
questions with no upvoted or accepted answers
0
votes
1
answer
63
views
Error: Make sure game is winnable (fifteen) won
bool won(void)
{
for(int i= 0; i<d; i++)
{
for(int j = 0; j <d; j++)
{
if((i==(d - 1)) && (j==(d -1)) && board[i][j]== 0)
{
if(board[i][j] <...
0
votes
1
answer
56
views
pset3 game of fifteen won() function does not work
Just in case, I'll put the code of the other functions, but they, like, are successfully tested.
void init(void)
{
int value = d*d - 1, c;
for(int i = 0; i < d; i++)
{
for(int ...
0
votes
1
answer
30
views
Pset3_Fifteen_Won()
bool won(void)
{
// TODO
for(int r=0;r<d;r++)
{
for(int c=0;c<d;c++)
{
if(c==r==(d-1))
{
if(board[r][c] != 0)
{
return true;
...
0
votes
2
answers
50
views
Pset3, Game of Fifteen, won, game keeps winning!
for the final part of fifteen, my game wins automatically upon start up and I'm not sure why, please help, thanks.
my code is as follows:
bool won(void)
{
//for each row
for (int i = 0; i < d; ...
0
votes
1
answer
89
views
Fifteen won returning ftw
Can anyone tell me why the code doesn't work as I had expected ? It keeps returning ftw even if it's not.
0
votes
2
answers
351
views
Won function of pset3 game of fifteen making error
My code is not able to compile clang is stating error in won function.
My code is as follows:
/**
* fifteen.c
*
* Computer Science 50
* Problem Set 3
*
* Implements Game of Fifteen (...
0
votes
1
answer
75
views
My won function is not working. I am getting the following checks. https://sandbox.cs50.net/checks/6ca6c632ceb0408aaac04be0ed215bfe
/**
* 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 are to be d x d,
* ...
0
votes
0
answers
122
views
Move function not working in Game of Fifteen
I cant seem to find the bug why my move function is not working for me, any help would be much appreciated
bool won(void)
{
int counter = 0;
// loop for rows to start from one position left ...
0
votes
0
answers
85
views
Why won't my won function return true?
I'm having an issue my won function to return true. When I use the 3x3.txt file I get an Illegal Move message when won should return true. Not really sure what I'm missing here.
Here is my code:
...
-1
votes
1
answer
306
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!