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

Username:   Password: 
 RegisterRegister   
 Win Function
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Carey




PostPosted: Fri Jun 01, 2007 7:58 am   Post subject: Win Function

A function that checks to see if there is a line in a 2d array. A couple people have pm'd me about it so i decided to port my Java version into Turing. It can probly be greatly improved as a made it a year ago. I got 100% in that class though so maybe not.


Win Function.t
 Description:

Download
 Filename:  Win Function.t
 Filesize:  3.33 KB
 Downloaded:  110 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Tallguy




PostPosted: Fri Jun 01, 2007 8:07 am   Post subject: RE:Win Function

it's a good start, what can it be applied to???
Carey




PostPosted: Fri Jun 01, 2007 8:50 am   Post subject: Re: Win Function

Tallguy wrote:

it's a good start, what can it be applied to???


It can be apliad to any board game where the object is to get a certain # of pieces in a row (TicTacToe, Connect four, O-Mok, etc). Just ask ZeppelinManiac. and what do you mean by a "good start"? it's finished except for efficiancy modifications.
ZeppelinManiac




PostPosted: Mon Jun 04, 2007 7:52 am   Post subject: Re: Win Function

awesome, thanks for porting it, now how do i apply it to mine? and is there anything i need to change in your code? if you need my code so far just ask. thanks carey
Carey




PostPosted: Mon Jun 04, 2007 8:35 am   Post subject: Re: Win Function

look at the example at the bottom of the .t file for how to apply it to your code. you could also put something like this:

code:

if win ([gameboard array], [player], [number in a row needed to win]) = true then
put "Yay somone has won!!"
end if

note: not actual code (wll not run) it's just a general example
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: