Results for "Author: bill soo"
This code demonstrates the technique of writing direct to graphical memory in a Kaleidescope. The technique basically maps an array to a bitmap address. Changes to the array then affect the bitmap. I first saw this method used by Simon Price.
This is a game of Gomoku. Traditionally, Gomoku is like a game of Tic-Tac-Toe except that you have to get 5 in a row and the playing board is either a 15x15 or a 19x19 GO board. For the purposes of this game, the board size is adjustable from 6x6 to 19x19 and the number needed to win is adjustable from 3 to 6. In a real Gomoku game, you have to have EXACTLY 5 in a row; 6 or more do not count. But for this game, 5 (or whatever) or more win. The game demonstrates how to set up an evaluation function, how to set up a minimax search and how to prune using the alpha-beta algorithm. The game looks ahead a certain number of plys (adjustable from 1 to 6) and picks the best move it can. Since a 15x15 board with 4 plys has up to 2.4 BILLION combinations, pruning the tree becomes important. The game does this by using the alpha beta algorithm. The algorithm works by comparing the value against a limit. If the limit is exceeded, the algorithm abandons the branch. An example in chess would be something like: move (A) has been examined and will, at worst, capture a pawn. We now examine move (B). If we find that in one variation, move (B) will lose a pawn, we abandon the branch, even if at best, move (B) could capture a queen. The reason is because we assume our opponent will do the smartest possible move so we are going to lose a pawn, which is worse than gaining a pawn with move (A). I wrote this in a bit of a hurry (I intend to use it as example source code in my resume) so I haven't finished commenting it yet. So please ask if you have any questions. Oh yeah, please vote for me if you like it. Also, if you beat the game on 4 ply or higher, let me know.
The line of best fit is the line that best fits a set of data that is more or less linear. There are a number of ways to calculate this but I'll use the method of sum of least squares. In this method, we find a line where the sum of the square of the distances from the line to each point is minimized. While that sounds complicated to do, the execution is actually quite simple. If you are interested in the derivation of the math, I found a website through GOOGLE that has the required formulas: http://people.hofstra.edu/faculty/S...regression.html For the line of best fit Y = M * X + B: M = (n *Sxy - Sx * Sy) / (n * Sx2 - Sx * Sx) B = (Sy - M * Sx) / n Where: n = number of points Sx = the SUM of all the X coordinates Sy = the SUM of all the Y coordinates Sxy = the SUM of all (x * y) Sx2 = the SUM of all (x * x) So to calculate the line of best fit, set up a bunch of variables like above. Then, everytime you get a new datapoint, update the variables and calculate a line using the equations. You can then check the coefficient of correlation using a formula found on the URL. In the Demo program, you simply click on the form to place data points. The program will then draw a line of best fit based on those data points. Double click on the form to clear it and start anew.
Graphical operations are amoung the slowest and most cpu intensive tasks a program can do. Using API calls over the native VB Methods can increase speed by several times, but you can get even better performance with Direct Memory Access (DMA). This project encapsulates DMA operations into a simple ActiveX DLL which converts a stdPicture object into an array. You then manipulate the array to change the picture.
This code demonstrates the technique of writing direct to graphical memory in a Kaleidescope. The technique basically maps an array to a bitmap address. Changes to the array then affect the bitmap. I first saw this method used by Simon Price.
This is a game of Gomoku. Traditionally, Gomoku is like a game of Tic-Tac-Toe except that you have to get 5 in a row and the playing board is either a 15x15 or a 19x19 GO board. For the purposes of this game, the board size is adjustable from 6x6 to 19x19 and the number needed to win is adjustable from 3 to 6. In a real Gomoku game, you have to have EXACTLY 5 in a row; 6 or more do not count. But for this game, 5 (or whatever) or more win. The game demonstrates how to set up an evaluation function, how to set up a minimax search and how to prune using the alpha-beta algorithm. The game looks ahead a certain number of plys (adjustable from 1 to 6) and picks the best move it can. Since a 15x15 board with 4 plys has up to 2.4 BILLION combinations, pruning the tree becomes important. The game does this by using the alpha beta algorithm. The algorithm works by comparing the value against a limit. If the limit is exceeded, the algorithm abandons the branch. An example in chess would be something like: move (A) has been examined and will, at worst, capture a pawn. We now examine move (B). If we find that in one variation, move (B) will lose a pawn, we abandon the branch, even if at best, move (B) could capture a queen. The reason is because we assume our opponent will do the smartest possible move so we are going to lose a pawn, which is worse than gaining a pawn with move (A). I wrote this in a bit of a hurry (I intend to use it as example source code in my resume) so I haven't finished commenting it yet. So please ask if you have any questions. Oh yeah, please vote for me if you like it. Also, if you beat the game on 4 ply or higher, let me know.
The line of best fit is the line that best fits a set of data that is more or less linear. There are a number of ways to calculate this but I'll use the method of sum of least squares. In this method, we find a line where the sum of the square of the distances from the line to each point is minimized. While that sounds complicated to do, the execution is actually quite simple. If you are interested in the derivation of the math, I found a website through GOOGLE that has the required formulas: http://people.hofstra.edu/faculty/S...regression.html For the line of best fit Y = M * X + B: M = (n *Sxy - Sx * Sy) / (n * Sx2 - Sx * Sx) B = (Sy - M * Sx) / n Where: n = number of points Sx = the SUM of all the X coordinates Sy = the SUM of all the Y coordinates Sxy = the SUM of all (x * y) Sx2 = the SUM of all (x * x) So to calculate the line of best fit, set up a bunch of variables like above. Then, everytime you get a new datapoint, update the variables and calculate a line using the equations. You can then check the coefficient of correlation using a formula found on the URL. In the Demo program, you simply click on the form to place data points. The program will then draw a line of best fit based on those data points. Double click on the form to clear it and start anew.
Graphical operations are amoung the slowest and most cpu intensive tasks a program can do. Using API calls over the native VB Methods can increase speed by several times, but you can get even better performance with Direct Memory Access (DMA). This project encapsulates DMA operations into a simple ActiveX DLL which converts a stdPicture object into an array. You then manipulate the array to change the picture.
This code demonstrates the technique of writing direct to graphical memory in a Kaleidescope. The technique basically maps an array to a bitmap address. Changes to the array then affect the bitmap. I first saw this method used by Simon Price.
This is a game of Gomoku. Traditionally, Gomoku is like a game of Tic-Tac-Toe except that you have to get 5 in a row and the playing board is either a 15x15 or a 19x19 GO board. For the purposes of this game, the board size is adjustable from 6x6 to 19x19 and the number needed to win is adjustable from 3 to 6. In a real Gomoku game, you have to have EXACTLY 5 in a row; 6 or more do not count. But for this game, 5 (or whatever) or more win. The game demonstrates how to set up an evaluation function, how to set up a minimax search and how to prune using the alpha-beta algorithm. The game looks ahead a certain number of plys (adjustable from 1 to 6) and picks the best move it can. Since a 15x15 board with 4 plys has up to 2.4 BILLION combinations, pruning the tree becomes important. The game does this by using the alpha beta algorithm. The algorithm works by comparing the value against a limit. If the limit is exceeded, the algorithm abandons the branch. An example in chess would be something like: move (A) has been examined and will, at worst, capture a pawn. We now examine move (B). If we find that in one variation, move (B) will lose a pawn, we abandon the branch, even if at best, move (B) could capture a queen. The reason is because we assume our opponent will do the smartest possible move so we are going to lose a pawn, which is worse than gaining a pawn with move (A). I wrote this in a bit of a hurry (I intend to use it as example source code in my resume) so I haven't finished commenting it yet. So please ask if you have any questions. Oh yeah, please vote for me if you like it. Also, if you beat the game on 4 ply or higher, let me know.
The line of best fit is the line that best fits a set of data that is more or less linear. There are a number of ways to calculate this but I'll use the method of sum of least squares. In this method, we find a line where the sum of the square of the distances from the line to each point is minimized. While that sounds complicated to do, the execution is actually quite simple. If you are interested in the derivation of the math, I found a website through GOOGLE that has the required formulas: http://people.hofstra.edu/faculty/S...regression.html For the line of best fit Y = M * X + B: M = (n *Sxy - Sx * Sy) / (n * Sx2 - Sx * Sx) B = (Sy - M * Sx) / n Where: n = number of points Sx = the SUM of all the X coordinates Sy = the SUM of all the Y coordinates Sxy = the SUM of all (x * y) Sx2 = the SUM of all (x * x) So to calculate the line of best fit, set up a bunch of variables like above. Then, everytime you get a new datapoint, update the variables and calculate a line using the equations. You can then check the coefficient of correlation using a formula found on the URL. In the Demo program, you simply click on the form to place data points. The program will then draw a line of best fit based on those data points. Double click on the form to clear it and start anew.
Graphical operations are amoung the slowest and most cpu intensive tasks a program can do. Using API calls over the native VB Methods can increase speed by several times, but you can get even better performance with Direct Memory Access (DMA). This project encapsulates DMA operations into a simple ActiveX DLL which converts a stdPicture object into an array. You then manipulate the array to change the picture.