Computer Science Canada

Win Function

Author:  Carey [ 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.

Author:  Tallguy [ Fri Jun 01, 2007 8:07 am ]
Post subject:  RE:Win Function

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

Author:  Carey [ 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.

Author:  ZeppelinManiac [ 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

Author:  Carey [ 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


: