[2008] Connect Four Detect Winner?
Jan 6, 2009
In our program we track the moves in arrays by columns 0 means empty, 1 means black, 2 means red so it would look like this for example
column1(0) = "1"
column1(1) = "2"
column1(2) = "2"
column1(3) = "1"
column1(4) = "0"
column1(5) = "0"
for column 1, and we have seperate arrays for each column (7 in all) but they all have the same values 0,1, or 2 so how can we make it check the arrays and their values and detect a winner?
View 6 Replies
ADVERTISEMENT
Nov 2, 2009
i have a two-dimensional char array that holds the values of a tictactoe board.Each element holds a value of either 'X','O', or and you can access the values with something like TicTacToe[0][1]with the first bracket containing the row # and the second containing the column #.
Whats the best way to detect the winner of a TicTacToe game? I was thinking about just making a function like this Private Function checkWin(Byval TicBoard as Char[][]) as Integer 'Return 0 if no winner, 1 if Player 1 wins, and 2 if Player 2 wins End Function Any ideas? I want to avoid using 8 if-else statements since that seems pretty inefficient and sloppy
View 1 Replies
Jul 7, 2011
I am programming the board game Sequence in vb 2010 and I have gotten to the point where I now need to figure out if someone has won or not
Here is a link to the game Sequence and it's rules: [URL]
I have looked at How to find the winner of a tic-tac-toe game of any size ? which is similar to my problem but gets very complicated if I wanted to try and migrate the idea to Sequence.
I am wondering if anyone has any ideas on how to tell if there is a winner?
The only way I can think of is keep a list of all the possible winning positions and I would not like to do that.
View 1 Replies
Jun 21, 2010
I am writing a noughts and crosses game and everything works but the checkwinner sub routine, so basically if someone gets three X's or O's in a row then a message box pops up saying either X has won or O has won.Below is what I have written in the sub routine.
[Code]...
View 2 Replies
Mar 10, 2009
I would like to ask how to connect our application to connected computers in a LAN.Will I use the winsock control?How can I run queries using a server database?Any answers are welcome.
View 3 Replies
Apr 16, 2012
I AM HAVING PROBLEMS WITH GETTING THIS PROGRAM TO DISPLAY THE WINNING MESSAGE. PLEASE ONLY REPLY WITH HELPFUL SUGGESTIONS HERE IS THE CODE I HAVE DONE
Public Class Form1 Dim flag As Boolean = False Private Sub Buttons(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click
If flag = False Then
DirectCast(sender, Button).Text = "X"
flag = True
[Code]...
View 1 Replies
Mar 11, 2010
Is there a way to detect if a object is over an other, and then do an action?Eg:There's a label and a picturebox.When I change the label's location it goes on top of the picturebox.Is there a way I can detect it, so that once it's on top of the picturebox I show a messagebox or so?
View 2 Replies
May 21, 2010
i dont want my local ip..its a remote computertheres diferent ranges in the ips but from where i am looking for the ip im connected to the same network..lets say my ip its 10.31.47.54 but the one i try to see if its one its the above....but its behind a firewall..i know its on...but when i ping from my code
View 22 Replies
Jan 12, 2012
I am using VB 2008 express and SQL Server 2008 express on a test basis and I used to connect VB express to a SQL database (created in SQL Server 2008 Express management studio) file and it work perfectly until my hard drive packed up and I had to get a new one, so I had to reinstall both of these again and copied my old databases from a backup I had. Now when I try to connect to the database file it cannot connect. Network related error or the instance name is incorrect. When I look at the advanced options in the connect dialog it shows my instance as .SQLExpress and my correct instance name is .SQL2008Express. I clicked OK on the connect dialog and manually changed my connection string to the correct instance and that worked but whenever I run the application in debug mode it give me the same error as above.
View 1 Replies
Dec 10, 2008
How to detect USB Drive (Stick) when plug/unplug in real time ?ps like : show drive label in textbox , " if plugged text1.text = E: " and " if unplugged text1.text = "" " in real tim
View 2 Replies
Jun 2, 2010
I have a webapp where a datagridview is populated with records from a database and one of the columns is a download link to download the zip or exe file. We have the zip files on our server, but not the exe files as those are on another department's server. We have all of the file available for download, but if the user as an option selected in a dropdown, those url's in the gridview are re-formatted to be the exe file's on the other dept's server, however they don't have all of them (some 20% are missing) which means if the user click's the link they get their server's 404 not found page and can't download the file.
My PM (Project Manager) is asking me if I can have our webapp detect that the file doesn't exist on their server and instead of them getting the 404 page, they don't leave our app at all and get a javascript popup window or the page is refreshed with a red mark (and a message) next to the link they clicked on, is something like that possible? I have 2 restrictions with this, I can't modify the database because it doesn't contain file paths, it only contains a small portion like (Clinton County, Eaton County, Traverse County, etc..) and the rest of the url is formatted on the fly when the page is rendered, so there's no way to mark the missing files and there's no way we can host the files.
View 5 Replies
May 3, 2012
I am using a richtextbox control on my form.I want a small code which can detect if any image has been inserted in the rtb or not.For e.g. user can just type some text or insert image also. Now if we select an image then we can get the type but I want a code which scans contents of rtb and gives me a true if an image is inserted or false if there is none.
View 8 Replies
Apr 5, 2009
I have roughly 20 text boxes on my form,When you press tab, it naturally selects all text in the box (highlighted in blue), so you can press any key, and it replaces it with that,That result is what I want, unfortunately, if you click into the text box, and tab back to it, it no longer selects all the text.I'm wondering how I can detect the tab event properly,I've tried adding a 'KeyDown' event to each text box, and then selecting the text, but the sub never runs, also tried detecting the tab event in my Main Form, thinking that perhaps the parent handles it and will receive that event, but.. No.I've thought of using an event like 'Activated' however, it will also run when the mouse is clicked.
View 4 Replies
Jan 13, 2010
making a class scheduling system. I want to detect conflict in day,section,start_time,end_time,room,teacher in the MSSQL database.
View 7 Replies
Aug 4, 2009
I have my own web browser and download manager... How can web browser detect when user wants to download a file? And how do I stop opening of IE window for file download?
View 1 Replies
May 21, 2009
Is there a way to detect if a My.Computer.FileSystem.CopyDirectory() has failed? It seems that if it fails the copy (i.e., not even space on the destination drive), it just quits and doesn't seem to throw me an error? I already have it in a Try/Catch block, but I'm using that to see if the source directory exists, I'm guessing I should use
[Code]...
View 3 Replies
Nov 30, 2009
detect if the system has Hibernation enabled, or in the case of Win2k if hibernation is even possible. I already know how to hibernate the computer via the Framework:
Application.SetSuspendState(PowerState.Hibernate, True, True)
but in my program I would like to provide the hibernate option only if the OS A) is new enough to be able to and B) has it enabled in the user's Power Options in the control panel.
View 5 Replies
May 20, 2009
I need to detect if a [blank] media (CD/DVD) is inserted into the D: drive for an internal software I'm writing. The drive is static as drive D:. How can I tell if media is inserted, first off, and secondly, is it possible to tell if it's blank?
View 2 Replies
Dec 2, 2009
what are some ways to detect file tempering
View 10 Replies
Mar 27, 2010
I'm writing a program and it's got a textbox for the user to enter values. Since the textbox text property should only be a "number", my program need to detect invalid charaters like "*/&()$" and tell the user to only enter a number. Does anyone have an idea how to do that?
View 6 Replies
Mar 30, 2010
Adding How would you detect if the user is using the computer? I want a program to detect if the user is using the computer (i.e. mouse and keyboard movements), and if the user doesn't type or move the mouse for a specific amount of time, it executes a command. Normally I would do this with the Application.Idle, but I want it to be detected throughout the system. Any starters?
View 22 Replies
Dec 1, 2011
can anyone give me a sample on how to make in vb.net a Dialup Network Connection (DUN) i tried google, it gives me RASDialer w/c is kinda >.< basically.what i wanted to implement first is to detect Modems... coz we have a 3G sticks here where we can connect to the net. after detecting the modem. then it will dial it. even without having the panel or dashboard of our modem stick.
View 1 Replies
Feb 23, 2009
How would I do this in VB.net? Example: Generate a form that will tell me the:
1. CPU
2. OS
3. RAM Used/Available
4. Framework Package Installed. Is there an easy way to do this?
View 2 Replies
Nov 3, 2009
Im trying to to detect what is in the string and so something for each different result but im not sure howto, here was my first idea but it obviously doesnt work as you cant use contains that way:
Select Case omg.Contains
Case "1"
MsgBox("1")
Case "2"
MsgBox("2")
End Select
View 3 Replies
Jul 2, 2010
How can I make a application there detects when the webbrowser navigates to another website?
View 8 Replies
Apr 21, 2010
Is there any way to determine that a system has automatic updates enabled and has the little yellow security center icon indicating that updates are available? I'd like to drop a little service on one of my servers to monitor for that condition but can't find a good resource to get started.
View 12 Replies
Jan 1, 2011
Is there any way to detect when a link is clicked in the webbrowser control? It's loading the same page back again.
View 2 Replies
Feb 24, 2011
Is there a way to detect when a laptop is docked or undocked? I know how to get the "dock" status of a laptop using GetCurrentHwProfile. So is there some type of event raised when a laptop gets docked/undocked that we can catch? I did do something similar in the past for the detection of USB devices using a ManagementEventWatcher ...
View 2 Replies
Jun 20, 2010
I have an application that starts from Sub Main and I need to run a sub when the system is about to shut down, restart or logoff so it can save it's settings. I found some code on google:
Imports Microsoft.Win32
Public Sub Main
AddHandler SystemEvents.SessionEnding, AddressOf OnShuttingdown
[Code]....
But it doesn't seem to work, Windows shuts down yes but when I re-start the vm and run the app it opens with the old settings, not the ones that I changed before I shut down the vm. Anyone know of a way to do this or to fix the code above, I don't think my OnShuttingdown event is being handled.
View 4 Replies
Jan 8, 2010
I have searched everywhere, and have not found an answer. I would like to know how to enable your form to detect if a process is started. Something like this:
If Process.Start("Process.exe") Then
MsgBox("Process is running")
Else
MsgBox("Process is not running")
End If
View 4 Replies