Bejewelled in c++

Pegun

Golden Member
Jan 18, 2004
1,334
0
71
Hey all, I'm having a minor problem. I'm trying to create Bejewelled in c++, as part of a project for my programming class. My professor is unavailable so i hope you guys wouldnt mind answering a question for me. Basically I have the board and it asks for where a user wants to move a piece. then it checks the row and column to find if the move is legal.

If you need the full project its at the follwing host: http://www.savefile.com/files.php?fid=6449163

EDIT::Basically the problem I'm having is that when i try to update the board and make a move, it won't recognize the fact that i want it to move the the right, or move down, both consisting or adding 1 to the row or column.

Note::I'm sorry my post is vague. I'm new at asking people for help with the program that haven't looked at it before. Thanks for the Criticism but realize this is all new for me.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Rule Number 1 for getting people to help you with your code: Make it easy for them.

a) If you want to let people download your code, give them a format they can use. Every common operating system can open zip files by default. No common operating system can open rar files by default. Most people aren't goign to install winrar to help you with your homework.

b) If you think the problem is in a specific part of the code, post that part of the code. Posting 350 lines of code in a box that will only display about 12-15 lines at a time is a sure-fire way to make people not want to look at your code. Find the 12-15 lines that you think are causing the problem, and just post those.

c) Say what the problem is, and any errors that the compiler gives you. "it wont work" doesn't say anything useful. "It prints the asterisk one square farther to the left than it should" or "It fails to move the peice, it just stays in the same location" could actually be a helpful description of the problem.
 

itachi

Senior member
Aug 17, 2004
390
0
0
if(mylocalcopy[r-1][c] = mylocalcopy[r][c]) seq_length++;

u missed a '=='.
if u still have problems, then i'll look at it again.
 

hooflung

Golden Member
Dec 31, 2004
1,190
1
0
Originally posted by: itachi
if(mylocalcopy[r-1][c] = mylocalcopy[r][c]) seq_length++;

u missed a '=='.
if u still have problems, then i'll look at it again.


think you just owned notfred... good work... hope you found the problem for the dude... 2nd pair of eyes always helps!
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Originally posted by: hooflung
think you just owned notfred... good work... hope you found the problem for the dude... 2nd pair of eyes always helps!
Not really, Pegun just got lucky this one time.

A lot of us that could help will just move on to reading Off-Topic instead if a poster makes us jump through hoops and try to fix vague "it don't work!" errors.
 

IdioticBuffoon

Senior member
Sep 11, 2005
327
0
0
Originally posted by: hooflung
Originally posted by: itachi
if(mylocalcopy[r-1][c] = mylocalcopy[r][c]) seq_length++;

u missed a '=='.
if u still have problems, then i'll look at it again.


think you just owned notfred... good work... hope you found the problem for the dude... 2nd pair of eyes always helps!

Grow up. It's not about "owning", it's about common sense. What he said applies to anyone who needs help with code.
 

itachi

Senior member
Aug 17, 2004
390
0
0
your problem isn't occuring there..

the reason why the directions aren't being interpreted is because of the same thing i noted earlier..

if ((row = 0) && (dir == 'u')) return false;

that statement will always be false, so the branch won't be taken. when you do (row = 0), the comparison that you're making is 0 && dir == 'u'. in C/C++, 0 is false.
the second if statement will always be taken when the direction is 'd'.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
think you just owned notfred

Notfred's advice was dead on. Not to thrash the OP (who it appears was caught by the oldest C "gotcha" in the book), but communicating with technical precision is a prerequisite for studying computer science.