Sunday, June 24, 2012 2:10 PM
1. Has anyone built the game of Reversi with a computer opponent using small basic.
2. In constructing a simple board game, what is the diff between using a button, a drawn cell, or a rectangle. Does one offer better mouse control, image control etc?
- Edited by jswlhw Sunday, June 24, 2012 2:10 PM
Sunday, June 24, 2012 3:48 PMModerator
Buttons are easier in general to hook up the click event. However changing the button colour or image is harder (can be done, but either needs extensions or careful coding to not have flicker or slow with lots of clicks and changes). For Reversi - you will want to do a lot of redrawing.
Using the mouse coordinates on a MouseClick is the other way. The event hook up is done by the mouse coordinates, which on a grid board game isn't too hard. So I would go this way, probably using some 2D arrays to store the black/white state of cells and any other cell related data. You can then use drawing or shapes (images) to display the grid.
The hardest part will be the AI for the computer turn, so I would start with the basic graphics, then based on selected cells do all the reversing (HINT the stack object will be useful for this), checking for a valid go, checking for a winner etc. Finally work on computer playing turns.
Sunday, June 24, 2012 4:30 PMThanks for the very quick response.
Saturday, June 30, 2012 3:50 AMAnswerer
This is not a Reversi but Tic-tac-toe, very tiny board game. I hope these will be your help.
Early version: http://smallbasic.com/program/?JKB381
Late version: http://smallbasic.com/program/?LBW762-3
- Marked As Answer by jswlhw Tuesday, July 03, 2012 3:51 PM
Saturday, June 30, 2012 7:14 PMThanks Nonki. I have studied your program LBW762-3 and think it is very good.