Using the mouse
Author |
Message |
Cervantes
|
Posted: Sun Mar 14, 2004 7:11 pm Post subject: (No subject) |
|
|
ooh tony you can't give up now!
Do you have your 2D array as a string? Cuz that's what it should be.
Moving the pieces is the easies part. I think the harder part will come when your checking to see if a certain move is valid (ie. if the unit goes through another unit.) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
jonos
|
Posted: Sun Mar 14, 2004 10:27 pm Post subject: (No subject) |
|
|
not really, you just check:
if user dropped night on (2, 2), and it was originally on (1, 1), then the move is not valid, but if the user dropped the kngight on (2,3) and it was originally on (1,1), then its valid (i think thats right).
you just have to keep the original placement in an array or variable, then check it against the new one. thats just for a knight though;, i don't know about the other ones. |
|
|
|
|
|
TheFerret
|
Posted: Sun Mar 14, 2004 10:50 pm Post subject: (No subject) |
|
|
I had my array as an int instead of a string...
Quote: maybe you should work on something simpler Thanks for the compliment... |
|
|
|
|
|
Tony
|
Posted: Sun Mar 14, 2004 11:00 pm Post subject: (No subject) |
|
|
heh, didn't mean to discourage you, but you did just plug in my pseudo-code into your program and wondered why variables types were off |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
TheFerret
|
Posted: Sun Mar 14, 2004 11:05 pm Post subject: (No subject) |
|
|
The reason why I don't know this is becuase I haven't did it before and I want this to be a learning experiece for me to make me a better programmer... |
|
|
|
|
|
Tony
|
Posted: Sun Mar 14, 2004 11:08 pm Post subject: (No subject) |
|
|
chess might be a bit of an overwhealming learning experience
but I'll try to help |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
TheFerret
|
Posted: Sun Mar 14, 2004 11:14 pm Post subject: (No subject) |
|
|
I meant for learning arrays and stuff like that procedures and mouse... |
|
|
|
|
|
the_short1
|
Posted: Mon Mar 15, 2004 1:29 pm Post subject: (No subject) |
|
|
i was thinking of makign chess... i though it would be ez... then i though about the movement.. and i said.. FUK dis... after i thougho of 3000 lines of code... not worth it... i want a simple program... less then 1500 lines
good abition ferret.... and if you read all the turotials on this site... you will be a way better programmer and be ahead of ur class in no time FLAT... then u can ask u teacher complicated stuff.. HEHE : |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
the_short1
|
Posted: Mon Mar 15, 2004 1:50 pm Post subject: (No subject) |
|
|
good point... unless u compsci teacher ROCKS... but yea.. |
|
|
|
|
|
Cervantes
|
Posted: Mon Mar 15, 2004 5:28 pm Post subject: (No subject) |
|
|
1-liner.. didn't answer a direct question... spam?
Anyways, Jonos -> that bit of code that you posted a ways back is all fine and dandy (yes, I know, I said dandy... ) but its not efficient.
your code:
code: |
if board (1,1) = "whiteknight" then
if coord_input = "2C" then
board (1,1) = " "
board (2,3) = "whiteknight"
end if
end if
|
Sure, it works. But it needs to be more generalized. That only works with the white knight in 1,1 going to 2,3.
I guess we'd need to make a function for each type of piece to check if it is a valid move.
Anyways, what part of the prog are you on Ferret? Have you finished the basic movement and coordinate input? |
|
|
|
|
|
TheFerret
|
Posted: Mon Mar 15, 2004 6:04 pm Post subject: (No subject) |
|
|
Well I can get the pawns to move up one sqaure and I haven't tried the rest of the pieces....
P.S. How do you set the title for the top of the run window, I know that it has to do with setscreen and title in the brackets but I don't know the rest of the code... |
|
|
|
|
|
the_short1
|
Posted: Mon Mar 15, 2004 6:21 pm Post subject: (No subject) |
|
|
setscreen ("graphics:600;400,title: My Chess Program")
or
View.Set ("graphics:600;400,title: My Chess Program")
and top get rid of that button bar
setscreen ("graphics:600;400,title: My Chess Program,nobuttonbar")
or
View.Set ("graphics:600;400,title: My Chess Program,nobuttonbar")
and to set the possition on where the window is..
setscreen ("graphics:600;400,title: My Chess Program,nobuttonbar,position:top;left")
or
View.Set ("graphics:600;400,title: My Chess Program,nobuttonbar,position:top;left")
although if you type setscreen or View.Set and then select it and press f9 it would have told u this... maybe look in the reference...that is what it is there for |
|
|
|
|
|
Cervantes
|
Posted: Mon Mar 15, 2004 6:44 pm Post subject: (No subject) |
|
|
Do you have the pawns moving like they were in the first code you posted where it used a bunch of if..elsif..end if statements to determine what was moved? Or have you got a better way of doing it?
Do you know how to use functions? |
|
|
|
|
|
TheFerret
|
Posted: Mon Mar 15, 2004 6:55 pm Post subject: (No subject) |
|
|
No, I do not know functions really well and it does not tell you how to make title in reference, I still have the same way as first post... |
|
|
|
|
|
|
|