Author |
Message |
AdeptZero
|
Posted: Thu Jun 19, 2008 12:59 am Post subject: Checkers King Problem |
|
|
I'm having a problem with my com sci final project, so it'd be nice if I could get some pointers or tips. I've gotten a red king to be displayed on the board, but I can't get it to move back. I used the same code as I did for the regular red & blue pieces. I can't see the problem, and the project is due tomorrow. Help would be greatly appreciated. Thanks!
Instructions
1. Simply download the files and save them under the same directory
Problem
1. Move any Red to the last row of the board.
2. A Red King will appear thus replacing the red piece that entered the last row
3. However, the Red King cannot be moved --> Problem
Description: |
|
Filesize: |
35.57 KB |
Viewed: |
206 Time(s) |
|
Description: |
|
Filesize: |
28.53 KB |
Viewed: |
156 Time(s) |
|
Description: |
|
Filesize: |
19.97 KB |
Viewed: |
180 Time(s) |
|
Description: |
|
Download |
Filename: |
temp.t |
Filesize: |
12.01 KB |
Downloaded: |
147 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
gitoxa
|
Posted: Thu Jun 19, 2008 12:09 pm Post subject: RE:Checkers King Problem |
|
|
The first thing I see is your validmove function. The big if statement:
Turing: | if turn = "R" then
...
elsif turn = "B" then
...
elsif turn = "R" and board (frompiecer, frompiecec) = "RK" then
...
elsif turn = "B" and board (frompiecer, frompiecec) = "BK" then
...
end if |
The logic there is a little off. The other problem lies in your "frompiececlicked" procedure.
Turing: | if (board (frompiecer, frompiecec) = turn) then
mouseclicked := true
end if |
|
|
|
|
|
|
Warchamp7
|
Posted: Thu Jun 19, 2008 7:48 pm Post subject: RE:Checkers King Problem |
|
|
Well, if you're using the SAME code as the normal red and blue pieces and you have it coded properly (as the game rules are), the problem is that your king is not allowed to move backwards if it has the normal piece code.
|
|
|
|
|
|
gitoxa
|
Posted: Thu Jun 19, 2008 10:25 pm Post subject: RE:Checkers King Problem |
|
|
It's coded to allow the kings to move backwards, other than the two things I pointed out. Because of them, the king can't move in any direction.
|
|
|
|
|
|
AdeptZero
|
Posted: Fri Jun 20, 2008 9:36 pm Post subject: RE:Checkers King Problem |
|
|
Is there any way I can fix this without adding a new parameter to turn for the Red King and Blue King?
|
|
|
|
|
|
gitoxa
|
Posted: Fri Jun 20, 2008 11:44 pm Post subject: RE:Checkers King Problem |
|
|
Here's a hint.
|
|
|
|
|
|
AdeptZero
|
Posted: Sat Jun 28, 2008 1:21 pm Post subject: RE:Checkers King Problem |
|
|
Although its already been evulated, I'm curious on how to solve this problem. Gitoxa, if I assign RK the value of turn plus "K", it still draws the red king. But I don't see the difference between that and what I currently have. Could you please explain? Thxs..
|
|
|
|
|
|
|