Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Using the mouse
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Cervantes




PostPosted: 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
Sponsor
sponsor
jonos




PostPosted: 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




PostPosted: 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... Laughing
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
TheFerret




PostPosted: 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... Crying or Very sad
Tony




PostPosted: Sun Mar 14, 2004 11:08 pm   Post subject: (No subject)

chess might be a bit of an overwhealming learning experience Laughing

but I'll try to help Smile
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
TheFerret




PostPosted: 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




PostPosted: 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 Wink :Very Happy
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Mar 15, 2004 1:33 pm   Post subject: (No subject)

the_short1 wrote:
then u can ask u teacher complicated stuff.. HEHE Wink :Very Happy


Laughing generally speaking, once you get pass sorting arrays - your teacher is no help Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Mon Mar 15, 2004 1:50 pm   Post subject: (No subject)

good point... unless u compsci teacher ROCKS... but yea..
Cervantes




PostPosted: 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... Rolling Eyes) 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, Confused what part of the prog are you on Ferret? Have you finished the basic movement and coordinate input?
TheFerret




PostPosted: 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




PostPosted: 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




PostPosted: 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




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 3  [ 35 Posts ]
Goto page Previous  1, 2, 3  Next
Jump to:   


Style:  
Search: