Click to open or copy the files for the Reversi sample.
This sample includes the following functions:
| Function | Description |
| UpdateCursor | Updates the cursor position |
| Checkdepth | Updates Skill menu items |
| Clearboard | Clears board and sets starting pieces |
| RevCreate | Creates Reversi; called on WM_CREATE messages |
| Printboard | Draws game pieces on board |
| ClearMessageTop | Clears message bar |
| ShowMessageTop | Displays string in message bar |
| Drawboard | Draws game board |
| RevPaint | Paints Reversi; called on WM_PAINT messages |
| FlashMessageTop | Sets up system timer for callback procedure |
| RevMessage | Outputs flashing message at top of window |
| Flashsqr | Flashes game piece |
| RevMouseMove | Updates cursor to show legality of move |
| ShowBestMove | Updates cursor and mouse position to show best move |
| Gameover | Finds a human reply to the computer's move |
| Paintmove | Makes a move and shows the results |
| RevMenu | Handles menu selections; called on WM_COMMAND messages |
| RevInit | Initializes window data and registers window |
| RevMouseClick | Handles mouse click or keyboard space or CR |
| Next | Finds next square |
| Previous | Finds previous square |
| ShowNextMove | Shows next legal move |
| RevChar | Handles keystrokes; called on WM_KEYDOWN messages |
| InverseMessage | Callback; inverts message bitmap or kills timer |
| ReversiWndProc | Processes messages for Reversi window |
| AboutDlgProc | Processes messages for About dialog box |
| WinMain | Calls initialization function, processes message loop |
| Finalscore | Calculates final score |
| Legalcheck | Returns 1 if move legal, else returns 0 |
| Makemove | Handles capturing of enemy pieces |
| Score | Calculates the value of board |
| Minmax | Plays human move then recursively plays computer move |
This sample uses the following keywords:
aboutdlgproc; beginpaint; checkdepth; checkmenuitem; clearboard; clearmessagetop; clienttoscreen; createsolidbrush; createwindow; defwindowproc; deleteobject; dialogbox; dispatchmessage; drawboard; ellipse; enablemenuitem; enddialog; endpaint; finalscore; flashmessagetop; flashsqr; gameover; get_wm_activate_hwnd; get_wm_activate_state; get_wm_command_id; getclientrect; getdc; getdevicecaps; getinstancedata; getkeystate; getmenu; getmessage; getstockobject; getsystemmetrics; gettextextentpoint; gettextmetrics; inversemessage; isiconic; killtimer; legalcheck; lineto; loadaccelerators; loadcursor; loadicon; loadstring; localalloc; localfree; long2point; lstrlen; makeintresource; makemove; makempoint; makepoint; makeprocinstance; messagebox; minmax; movetoex; next; paintmove; patblt; postmessage; postquitmessage; previous; printboard; registerclass; releasecapture; releasedc; revchar; revcreate; reversiwndproc; revinit; revmenu; revmessage; revmouseclick; revmousemove; revpaint; rgb; score; selectobject; setbkmode; setcapture; setcursor; setcursorpos; setfocus; settimer; setwindowtext; showbestmove; showcursor; showmessagetop; shownextmove; showwindow; textout; translateaccelerator; translatemessage; unreferenced_parameter; updatecursor; updatewindow; width; winmain