# Help creating peg solitaire game

**URL:** <https://forum.kirupa.com/t/help-creating-peg-solitaire-game/225447>\
**Category:** Uncategorized\
**Created:** [May 11, 2007, 8:43pm UTC](https://forum.kirupa.com/t/help-creating-peg-solitaire-game/225447 "2007-05-11T20:43:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greendog](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@greendog](https://forum.kirupa.com/u/greendog)\
**Post date:** [May 11, 2007, 8:43pm UTC](https://forum.kirupa.com/t/help-creating-peg-solitaire-game/225447/1 "2007-05-11T20:43:16Z")

</div>

I’m creating a peg solitaire game (ie.[http://www.bannerblog.com.au/2007/05/peg\_solitaire.php](http://www.bannerblog.com.au/2007/05/peg_solitaire.php))  
I have the stage all set, I’m just sitting here scratching my head on how to make it work.  
Here’s my code:

```auto
function newhole(libName, instName, size, xpos, ypos) {
    attachMovie(libName, instName, getNextHighestDepth());
    this[instName]._width = size;
    this[instName]._height = size;
    this[instName]._x = xpos;
    this[instName]._y = ypos;
}
function row(libName, instLett, maxrow:Boolean, firstNum:Number, row:Number) {
    if (maxrow == true) {
        newhole(libName, instLett+(firstNum), 16, 75, row);
        newhole(libName, instLett+(firstNum+1), 16, 100, row);
        newhole(libName, instLett+(firstNum+2), 16, 125, row);
        newhole(libName, instLett+(firstNum+3), 16, 150, row);
        newhole(libName, instLett+(firstNum+4), 16, 175, row);
        newhole(libName, instLett+(firstNum+5), 16, 200, row);
        newhole(libName, instLett+(firstNum+6), 16, 225, row);
    } else if (maxrow == false) {
        newhole(libName, instLett+(firstNum), 16, 125, row);
        newhole(libName, instLett+(firstNum+1), 16, 150, row);
        newhole(libName, instLett+(firstNum+2), 16, 175, row);
    }
}
row("holeMC", "h", false, 1, 50);
row("holeMC", "h", false, 4, 75);
row("holeMC", "h", true, 7, 100);
row("holeMC", "h", true, 14, 125);
row("holeMC", "h", true, 21, 150);
row("holeMC", "h", false, 28, 175);
row("holeMC", "h", false, 31, 200);
row("pegMC", "p", false, 1, 50);
row("pegMC", "p", false, 4, 75);
row("pegMC", "p", true, 7, 100);
row("pegMC", "p", true, 14, 125);
row("pegMC", "p", true, 21, 150);
row("pegMC", "p", false, 28, 175);
row("pegMC", "p", false, 31, 200);
unloadMovie("p17");
attachMovie("pegMC", "dragPeg", getNextHighestDepth());
this.dragPeg._x = 0;
this.dragPeg._y = 0;
this.dragPeg._width = 16;
this.dragPeg._height = 16;
this.dragPeg._alpha = 0;

```
