Sunday, February 2, 2014

Online Blackjack Automation using Sikuli & Basic Strategy with Code

This is a demo of using sikuli automation online blackjack. About 350 lines of code. This can save you lots time playing and remembering the basic strategy table.
1. this is a normal online blackjack

2. starting skikuli

3. about 350 lines of code



4. the basic strategy table is coded into the program. All the actions are based on this table.

5. the program can do everything, includes split and double.
code can be downloaded from


Saturday, January 11, 2014

Online Roulette Automation using Sikuli

Sikuli is an easy to use graphic based machine automation program. It is capable of automating complicated graphic programs without touching the underlay program or interfaces. The Jython or python script is easy to understand and program. This video showing using Sikuli to automate betting on online Roulette. It uses some martingale system. As you can see winning is not guaranteed as there is a maximum betting amount limit on the table. Also continuous same color number happens quite often. I have encounter 13 red in a role. Which i believe will be very rare in real physical Roulette. This automation is only for fun. As computer strictly follow the system you programmed, there is less human motion involved and create less stress when losing money. It also saves hard work of clicking.

Tutorials will come later showing how to use Sikuli. It is not so difficult. This one only contains 150 lines of coding.


1. start online casino

2. go to roulette

3. start sikuli for automation

4. this is the 150 line code

5. click run to execute

6. start at 19:38

7. this is 20:30

8. finish at 21:19, did 200 betting cycle. And I was free to have dinner and watch TV. Although did not win much.


Thursday, April 26, 2012

Gambling Automation - Workflow design

01.WORKFLOW DESIGN:
          1.01 go to next race
          1.02 get next race time, and wait until 30 seconds before betting close
          1.03 get all the runners info
          1.04 sort runners by odds
          1.05 pick runner by some rules, you can apply your own rules here, I will simply pick the runner got smallest odds
          1.06 bet on win
          1.07 wait until betting close
          1.08 GOT BACK TO '1.01 go to next race' and start a new cycle, stop if predefined condition is met. for example we can ask the program to stop if it has bet 50 races.
02 IMPLEMENT GO TO NEXT RACE: first creat test button, for testing purpose, rename to buttonTest


by using the developer tool in IE 8, we found that the next three races will bring us to an URL which will give us the information about next coming race


create a new method gotoNextRace() in AutoSports.cs, and use browser.goto("url") method, paste the url we just uncovered




now, go to Form1.cs[design], couble click test button we created before, and add the gotoNextRace() method into that block. So program will run gotoNextRace if somebody clicks Test Button.

run the program by pressing F5, after click test button, you should be able to see something like below


Wednesday, April 25, 2012

Gambling Automation - Site Log in

01 UPDATE USER INTERFACE: add button, change text to 'login', change name to 'buttonlogin'
02 CREATE CODE FOR LOGIN:   Click Project-> add class.... , add new class called AutoSports.cs to put the automation methods.
create a login method in it, cut the Browser line created in last post in Form1.cs into AutoSports class, import 3 required packages, add the try block in the new created login method, this will prevent any crash if the login process goes wrong,  add writeLine in the catch block, so if things go wrong you will be informed.

open your ie8, go to http://www.sportsbet.com.au/, and press F12 to bring the developer tool, click the top left arrow and then click user name input box, this will bring you the code behind it, Check the element id is 'username', same you can find id for password box is 'password', and login-button's id is'login-button'.

add the following code into method login, I change browser object name to br, to save typing time. the if sentence is to check if being logged in already. the following lines are straightforward, fill in the info and click the button

go to form1.design change the password textbox to shown stars

create AutoSports object from the AutoSports class we just created in Form1.cs

double click Login button will bring you the code block, fill in the function you want the program to do after you click that button, here we want the program to DO log in


 03 TEST LOGIN: press F5, or click Debug->Start Debugging to try out, you should be able to see the following after click the log in button if you have an account with that site.

05 CODE:
*****************************
AUTOSPORTS.CS
*****************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;
using NUnit.Framework;
using System.Xml.Linq;
namespace sportsbetAuto
{
    class AutoSports
    {
        Browser br = new IE("http://www.sportsbet.com.au/");
        public bool login(string id, string pw)
        {
            try {
                if (!br.Element(Find.ById("log-out")).Exists)//do not login if already logged in
                {  
                    br.Element(Find.ById("username")).SetAttributeValue("value",id);
                    br.Element(Find.ById("password")).SetAttributeValue("value", pw);
                    br.Element(Find.ById("login-button")).Click();
                }
                return true; }
            catch (Exception e){
                System.Console.WriteLine("ERROR! Login Failed!");
                return false;
            }
        }
    }
}
****************
FORM1.CS
***************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WatiN.Core;
using NUnit.Framework;
using System.Xml.Linq;

namespace sportsbetAuto
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        AutoSports autos = new AutoSports();
        public Form1()
        {
            InitializeComponent();
        }
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            autos.login(textBoxLoginID.Text, textBoxPassword.Text);
        }
    }
}


Tuesday, April 24, 2012

Gambling Automation - Setup & test WATIN

01. CREATE PROJECT: start Microsoft vs c#, click File -> new project. Pick "Window Forms Application" Template and click OK.

02.CREATE GUI: create labels, and corresponding textbox, rename the first one to"textboxLoginID", second one to textboxPassword" as in screen capture.
03.ADD WATIN REFERENCE: right click references in solution explorer, and pick add reference, browse to witin.core.dll and click 'OK',
add nunit reference. if you don't have nuit installed, search on google and install it . do similar thing, add System.Xml.Linq. this package is used to parse xml.

click on System.Xml.Linq, change property embedd interop type to False, otherwise you will get error message and can not run.

click Project -> xxxxx properties... change the target framework to main framework

04. TEST WATIN ENVIRONMENT: add the following code into the form1cs. press F7 in the Form1.Design will bring the code to you.

then click Debug ->start debugging or press F5 to run the project, you should be able to see something like this. the foreground window is the form created, the background is the IE with targeted web site.

05 FULL CODE IN FORM1.CS:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WatiN.Core;
using NUnit.Framework;
using System.Xml.Linq;

namespace sportsbetAuto
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        Browser sportBrowser = new IE("http://www.sportsbet.com.au/");
        public Form1()
        {
            InitializeComponent();
        }
    }
}



Gambling Automation - Preperation

Hi there, I am going to teach you how to use ms visual studio c# express and web automation package watin to do some gambling web site automation (computer betting automatically based on some rules you set up, so you can do something else) . First of first is to setup the developing environment. and they are all FREE!
01 download and install visual studio c# express from http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express


02 go to watin site http://www.watin.org/ to download and install the package into your visual studio c#, a video tutorial on how to install is available at: http://watin.org/documentation/getting-started/

03 after all set up, follow the simple video to test your first web automation.