|
Hi,
IMO a chess game consists of four parts:
- a GUI
- a move generator
- a move selector
- a chess knowledge database
Of these the GUI is the easiest part; mind you, a lot of chess games include a 3D GUI, but I always turn it off, as it hinders my view on the board, it doesn't help me a bit.
The move generator also is a simple part, except the quality of the game will depend on how FAST you generate the moves; bitarrays are a popular approach here (google for "bitarray", and I do not mean the BitArray class!)
The move selector is the hard part; that is where years of research is being spent by several companies selling chess games. Basically a lot of possible moves are considered one by one, all possible replies are considered, etc etc up to a certain depth, and then a min-max optimisation is performed; to shave of some processing time, this huge tree gets "alpha-beta" pruned. You will need detailed knowledge in all of these
in order to come up with anything half decent.
Once you got these three, you may have a program that plays a kind of chess; it may or may not be fast enough not to work on your nerves; and it will for sure play a lot of ridiculous moves...
Since finally you need a database; both the opening and the ending of the game cannot be handled well by brute force approaches; so you need a database that knows the "normal openings", as well as the typical dealing with all kinds of endgames.
Most hobbyists in this field don't spend any time in the GUI part, they tend to come up with "chess engines" (i.e. move generator + move selector) that plugs into an existing chess GUI, of which there are many available, as freeware. And almost all the value of the game in the end resides in the database.
BTW: I hope you have been playing chess for many years. What is your current ELO rating?
PS: you said it was urgent. Why is that? Did you plan something special in the next ten years?
PS2: I would never, never, consider developing a chess game in VB.NET; I definitely need all the performance I can get, so I'd go with either C, C++ or C# (with a couple of unsafe blocks for sure).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hello,
Here is the situtation:
1 exe (acting like main menu) that launches 1-N dlls where each dll is seperate application. The exe and dlls all are sharing the same memory for the environment. We have a business requirement that if one of the applications is showing a dialog box, it cannot lock up the other running applications-ugly work around but we have accomplished this. Because N number of windows can be running at once there is a feature called, clever enough, "Show Open Windows" which when shows disables all the running forms so that the user must get rid of showopen windows before they can do anything else. While this action was not a problem, if any of those forms where showing dialogboxes then the dialog boxes were still enabled allowing the user to interact with them. I created an extension to the form to use a custom ShowDialog routine that setup an event that if the calling form's enabled problem changed then change the enabled property within the dialog box works fine.
The problem is if the parent form(one that showed the dialog) is disabled by the "show open windows" call, when it is reenabled by the showopenwindows going away, the dialog remains on top of the calling form but you can interact with the calling form - changing it's context etc. This is easily repeatable including if you use a msgbox.
Is there any value/flag that I can test for and reset to get the form back into the state where you can't interact with it until it's dialogbox goes away?
Example of the code to make this behavior happen:
'note #1: the first timer was used to check the enabled property for it's state
'note #2: the second timer disables the form 5 seconds after you click on the button to show the messagebox. 5 seconds after that the form will reenable allowing you to interact with it even though the message box is still showing.
Public Class Form1
Private _timer As Timer
Private _timerdisable As Timer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
_timer = New Timer(500)
_timer.AutoReset = True
AddHandler _timer.Elapsed, AddressOf Timer_Elapsed
_timer.Enabled = True
_timerdisable = New Timer(5000)
_timerdisable.AutoReset = True
AddHandler _timerdisable.Elapsed, AddressOf TimerDisable_Elapsed
End Sub
Private Sub Timer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If Me.InvokeRequired Then
Me.Invoke(New Action(Of Object, System.Timers.ElapsedEventArgs)(AddressOf Timer_Elapsed), Nothing, Nothing)
Exit Sub
End If
Me.Text = Me.Enabled.ToString & "::" & Now.ToString
End Sub
Private Sub TimerDisable_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
If Me.InvokeRequired Then
Me.Invoke(New Action(Of Object, System.Timers.ElapsedEventArgs)(AddressOf TimerDisable_Elapsed), Nothing, Nothing)
Exit Sub
End If
'----
'stop the timer so it doesn't disable the form again.
If Not Me.Enabled Then _timerdisable.Enabled = False
'-----
Me.Enabled = Not Me.Enabled
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
_timerdisable.Enabled = True
MsgBox("HEY")
End Sub
End Class
after form is disabled and then enabled you can now grab the title bar of the calling form and move it around.
Thank you
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
You could also try to create non-blocking variants of the dialogs; Show a window, set a boolean to indicate that it's showing something. When the flag gets set , attach a delegate to one of the events that fire when the form closes to reset the bool.
I are Troll
|
|
|
|
|
Thank you for replying...
"non-blocking variants of the dialogs;" - not doable... too much code would need to change to mimic the dialog behavior with the calling form.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Turns out, the value/flag in question is the property 'CanFocus'. This property is of course 'readonly'. Does anyone know how to override this value behind the scenes(api call or whatever)?
thank you
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
I don't know why I'm getting this InvalidOperationException - so I'm really eager to find an explanation and learn from this bug.
the code:
Imports myprog.Control_DataCapsule 'this is a control containing several text boxes and buttons
Class Window1
Private MSVMobject As ClassMSVM = Nothing
Private Sub Window1_Loaded()
Try
MSVMobject = New ClassMSVM
AddHandler MSVMobject.VMexited, AddressOf Me.MSVM_VMexited
Catch
MsgBox("MSVM is not available on this machine.")
End Try
End Sub
Friend Sub MSVM_VMexited()
.
.
.
Dim OdataCapsule As Control_DataCapsule 'causes an invalidOperationException
.
.
.
End Sub
Private Sub StackPanel_ButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
MSVMobject.StartVM()
End Sub
End Class
Public Class ClassMSVM
Public Event VMexited()
Public Sub StartVM()
.
.
.
Dim myProcess As Process = New Process()
myProcess.StartInfo.FileName = strStartupPath + "vmconnect.exe"
myProcess.StartInfo.Arguments = "localhost " + VMname
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.StartInfo.CreateNoWindow = True
myProcess.EnableRaisingEvents = True
AddHandler myProcess.Exited, AddressOf Me.VMconnectExited
myProcess.Start()
End Sub
Friend Sub VMconnectExited(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myProcess As Process = DirectCast(sender, Process)
myProcess.Close()
'trigger event that will be captured in Window1.xaml.vb
RaiseEvent VMexited()
End Sub
End Class
'in a separate vb file...
Partial Public Class Control_DataCapsule
'member variables
Public m_iIndexInList As Integer
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
m_iIndexInList = 0
End Sub
'*** SET ***
Public Sub SetTitle(ByVal strTitle As String)
Me.TextBoxTitle.Text = strTitle
End Sub
.
.
.
End Class
What happens is that after I click a button in my stackpanel, MSVM is launched. This works great.
Once I close MSVM, the MSVM_VMexited() sub starts to execute but as soon as it gets to "Dim OdataCapsule As Control_DataCapsule" an InvalidOperation Exception is thrown.
why is it that this exception takes place ?
EDIT:
the purpose of doing the "Dim OdataCapsule As Control_DataCapsule" is so that I can DirectCast() each control in my StackPanel and enable buttons.
|
|
|
|
|
what I've done now is declare OdataCapsule as a member variable of Window1 (temporarily called it "myOdataCapsule" for this experiment), and the program gets farther... however, now the following fails:
myOdataCapsule = DirectCast(Me.StackPanel1.Children.Item(iSPindex), Control_DataCapsule)
myOdataCapsule always equals Nothing !
This is a problem since I used the DirectCast to gain access to methods in Control_DataCapsule (many of these are stored in the stackpanel) to enable and disable buttons on the controls.
Overall goal
Somehow I need to step through the Control_DataCapsule's in the stackpanel once Window1 receives the VMexited event. My implementation above is the only way I thought I could
|
|
|
|
|
I then decided an alternative might be just to disable and enable the stackpanel on the Window1
Private Sub StackPanel_ButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
Me.StackPanel1.IsEnabled = False 'instead of individually disabling buttons in each control on the stackpanel
MSVMobject.StartVM()
End Sub
Friend Sub MSVM_VMexited()
Me.StackPanel1.IsEnabled = True
End Sub
However, "Me.StackPanel1.IsEnabled = True" still caused the exception
|
|
|
|
|
Hi,
I'm not familiar with RaiseEvent as I work mainly in C#, however it seems to me you are having a typical invalid cross-thread situation: the VM signals its exit on some thread (probably a ThreadPool thread) because it is fully asynchronous and MS didn't want to force it onto the main thread.
So IMO you need the same Control.InvokeRequired/Control.Invoke stuff you would need when trying to access some Control from a secondary thread, see here[^].
BTW: I don't really believe Dim OdataCapsule As Control_DataCapsule was ever throwing an exception as this statement is purely declarative, there is nothing executing there.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
As I am unexperienced in WPF, I won't be able to help you. Sorry.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi!
I have next problem:
1)I need to create RDL report,which consists of table and grafical punch.
Problem: Graphical punch is different for 1-st and others pages is different.
At first page graphical punch must be unique and for next pages he is the same...
After the punch must be table.
i tried different conbinations in hiding graphical punch(from 1-st page), he is really hiding but there are BREAKS(((
But graphical punch must merge with table at all report
How to solve this problem!
Thanks in advance!I hope for helping...
|
|
|
|
|
Works in Access 2003 but not in Access 2007.
I have this control on a form and it work fine in 2003 on an XP SP2 machine running IE6. It does not work on the same machine running IE 7. Or on a similar machine running Access 2007 and IE 6.
Does anyone know why and how to resolve?
Thanks for your input.
|
|
|
|
|
I'm no expert, but wouldn't it help to define "does not work"? How can anyone tell you what's wrong if they have no idea what the problem or error message is?
|
|
|
|
|
The WebBrowser Control does not display anything. It is not either initializing or is not able to be identified. It simply does not display anytyhing. I've searched the internet and have found lots of people speaking of issues with the WebBrowser Control and how it does not work in Office 2007 and also has issues under IE 7 but I have not found a solutions.
|
|
|
|
|
Hi all,
Im using Vb6 and acccessing an Oracle DB but im missing a Reference Oracle InProc server 5.0 type library . I ve tried registering the Dll Interop.OracleInProcServer.dll.Its loaded but the entry point is not valid.Does anyone know what the problem is
thanks in advance
|
|
|
|
|
And oh..Ive installed Oracle client on my machine..
|
|
|
|
|
If your program pops up a message box with the code, will the rest of the program wait until you push ok or will it continue to run in the background. I think mine continues to run in the background and i was wondering if there was a way to make it wait for a user response.
Thanks
|
|
|
|
|
If you application does not use any other threads than the main GUI thread, your app will wait for a user to react to the messagebox.
My advice is free, and you may get what you paid for.
|
|
|
|
|
RyJaBy wrote: If your program pops up a message box with the code, will the rest of the program wait until you push ok or will it continue to run in the background.
It will show in front of it's parent[^].
RyJaBy wrote: I think mine continues to run in the background and i was wondering if there was a way to make it wait for a user response.
Add a Debug.WriteLine("Foo!") just after the MessageBox.Show or the Form.ShowDialog methods. Run your application and watch the debugscreen. If you see your a "Foo!" passing by in the debugger, the dialog is invisible. Once it goes out of scope, it will get picked up by the garbage collector.
You could also add a timeout; this article[^] explains how
I are Troll
|
|
|
|
|
Dear All,
I have a small problem with VB.net. I have written a program that records data that comes from a wireless EKG recorder. What i now want is to add the possiblity to open and show the data to the user. I want to draw the wave from in a picture box(which is allready working). The problem is though that i can only draw the data to the width of the picture box. What i would like is to scroll through the data with a scroll bar so that i can see the data from the beginning to the end.
Could any of you point me in the right direction.
I thank you in advance
Yours,
D
|
|
|
|
|
It depends on how exactly you are drawing the wave at the moment.
If you did it right (used the paint method, points and brushes, etc.), you don't need to use a picturebox at all. You can draw directly onto the form.
However, your basic problem is that an EKG changes continuously. If you would leave it recording for long enough, You could end up scrolling for minutes on end.
You should probably look into a grid type solution, and maybe an array of maximum visible pulses or something. Each time a new pulse is recorded, you drop away the oldest entry from the beginning of the array, add the new pulse to the end, and redraw the whole thing onto the available surface.
My advice is free, and you may get what you paid for.
|
|
|
|
|
This is only ONE POSSIBILITY!
Put a Panel control inside another Panel control. On the outside Panel, turn on the AutoScrollBars. ON the inside Panel, you make it as wide as you need and draw your data on it in its Paint event. Walla, instant scrolled image. And NO PictureBox control.
|
|
|
|
|
I fully agree.
Until someone misreads this as "it takes two panels to do what a picturebox does".
Personnally, I would make sure to only ever paint the visible part, assuming the waveform might be orders of magnitude larger than the display.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
True. I only brough up this implementation because it is easier to "throw together" and test some idea. If the control is REALLY wide, like you said, the implementation gets a bit more complicated with throwing down a panel, seperate scrollbar, something to specifiy data frame size, filtering the data, then scaling and rendering.
|
|
|
|
|