# AI help please

**URL:** <https://forum.kirupa.com/t/ai-help-please/311424>\
**Category:** flash\
**Created:** [July 6, 2010, 2:43pm UTC](https://forum.kirupa.com/t/ai-help-please/311424 "2010-07-06T14:43:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackout188](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@blackout188](https://forum.kirupa.com/u/blackout188)\
**Post date:** [July 6, 2010, 2:43pm UTC](https://forum.kirupa.com/t/ai-help-please/311424/1 "2010-07-06T14:43:39Z")

</div>

The effect I’m trying to achieve here is during AI’s turn it will look into the select array to see if the number have been taken by player or not, if not the computer will select the number and disable the position so that player won’t be able to selected. In the same time, the computer will move its character to where the number is located. I do have a long working code but its extremely massy, and its in the attachment. All help are appreciated

aiarray is the order the number that will be selected by AI during its turn  
arrayx is the x cordinate for the ai character to move( for example the x cordinate of #7 is 319)  
valy is the y cordinate of each number which remain static.  
contain is the function that check if the number exist in the select array or not.  
select are all the number that have not been selected  
cho are the location that ai char will move

```auto

public var aiarray:Array=new Array(null,7,6,8,5,9,4,10,3,11,2,12,1,13,14)
public var arrayx:Array=new Array(null,319,265,375,210,428,157,486,97,545,51,600,10,656,717)
  public var valy:int=492
for(i=1;i<14;i++){
    if(contain(aiarray*,select)==1){
     compsele.push(aiarray*)
     ("cho"+i).mouseEnabled=false
     ("computerchar"+turn).x=arrayx*
     ("computerchar"+turn).y=valy
     turn--
     trace("hello")
    }
   break;   
}

```
