+ Reply to Thread
Results 1 to 2 of 2

Drag&Drop pieces for my strong VBA chess engine

  1. #1
    Registered User
    Join Date
    12-22-2016
    Location
    Germany
    MS-Off Ver
    Office 2010
    Posts
    1

    Drag&Drop pieces for my strong VBA chess engine

    Hello,
    my question: How to implement Drag&Drop with chess piece images on a chess board with VBA.
    The current version works with click events and image changes for fields on the board.

    If somebody wants to see a strong VBA chess engine:
    My program ChessBrainVB for Excel / Word / Powerpoint calculates about 10.000 chess positions per second using the slow VBA interpreter (playing strenght 2200 ELO).
    The compiled VB6-exe is 15 times faster (150.000 positions/sec, 2750 ELO) and can be used with standard chess GUIs ( i.e. ARENA).
    Download: https://github.com/RZulu54/ChessBrainVB/releases

    ChessBrainVBA_Screenshot.jpg

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Drag&Drop pieces for my strong VBA chess engine

    Hi Roger and welcome to ExcelForum,

    Very nice job on the Chess game.

    I think the solution to your problem is by being able to interpret Mouse_Move events in clsBoardField. I added Mouse_Up and Mouse_Move events to see what happens. I didn't have time to figure out the coordinate system, but it seems like all the information is there.

    clsBoardField excerpts:
    Please Login or Register  to view this content.
    When I depress the mouse button (value = 1) and move from square 8 to square 24 then release the mouse button (value = 0) I get the following Scenario:
    a. Mouse Down and Mouse Up in Square 8
    b. Mouse Down in Square 8
    c. Drag to Square 24
    d. Mouse Down and Mouse Up in Square 24
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Conclusion:
    a. Mouse_Up event always is paired with the Mouse_Down event. Mouse_Down in Square8 and Mouse_Up in Square24 always generates a Mouse_Up in Square 8 event (not very useful).
    b. Mouse_Down followed by Mouse_move with Button value NON-ZERO is Useful. The Mouse_Down indicates the square where the 'Drag and Drop' started.
    c. When Mouse_Move Button changes from 1 to 0 (followed by Mouse_Up for original square) indicates the end of the 'Drag and Drop'. If you can convert the XY coordinates into a 'Square Number', you should be all set to interpret the request as a move request.

    On further investigation, I see that the top/left of each square is 0,0. That makes what I did above useless. However, if you can generate an event for the entire board, you can then resolve the Mouse Events into the proper squares.

    I hope this helps.

    Lewis
    Last edited by LJMetzger; 12-23-2016 at 12:03 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Need Help : Chess Queen & King Movement
    By grv114 in forum Excel General
    Replies: 6
    Last Post: 04-27-2021, 03:27 PM
  2. [SOLVED] Drag and Drop data using Treeview -Working great for the first drop, but locking on 2nd
    By graym463 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2016, 09:38 AM
  3. Need Help : Chess Queen & King Movement
    By grv114 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-06-2016, 10:30 AM
  4. Index/Sum Formula -Drap Drop Column, Help with Drag Drop Row
    By bbis21 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2015, 09:36 PM
  5. Drag&drop outlook email to drop zone in excel
    By mpx300 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2015, 05:00 PM
  6. Replies: 2
    Last Post: 04-07-2015, 04:01 PM
  7. how to get the chess notations in columns?
    By sumesh56 in forum Excel General
    Replies: 38
    Last Post: 05-01-2014, 07:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1