Staredit Network > Forums > Technology & Computers > Topic: Simple AI Algorithm
Simple AI Algorithm
Jun 11 2008, 1:26 am
By: InsolubleFluff  

Jun 11 2008, 1:26 am InsolubleFluff Post #1



Okay, so I have only one thing left to do for my summative to be COMPLETE. I have figured out the algorithm (ish) but need to know how I would code it.

So basically it's called "blob wars".
When you select a piece you can move either one square or two squares away. One square duplicates your blob at the spot selected, two squares however makes your old one dissapear, and your new one re-appear.

So I am dealing with a 2d array of int values.
0 == No occupying blobs.
1 == Null spot (cannot ever be occupied).
2 == Player 1 blob.
3 == Player 2 blob.
4 == Available move adjacent to selected blob.
5 == Availabe move two spaces away from selected blob.

So, for my AI, what I reckon I need done is.
Go through the 2d array and upon arrival of a 2nd player blob, check all available moves of that blob. Then from all available moves, check all player 1 blobs that would-be converted. Keep doing this until I find the blob with the move with the best outcome ELSE, just pick a random spot (if no spots will gain you blobs)

So I currently have methods that:
Checks all available spots (works)
Check all adjacent spots (unsure)
Clears all available spots (works)

a temporary counter and a permenant counter, and only when the temporary counter is > maxcounter will it say "this move is the best move".

So what I know:
I need to store x and y co-ordinate of the spot with the best move
then say "boardArray[x][y] = 3;"

Any input on how to do this would be amazing



None.

Jun 11 2008, 1:45 am frazz Post #2



You're being too vague. NOBODY can code what you want until you figure out EXACTLY what it is that you want.
Write pseudocode!

A tip, your array should only contain values 0 to 3. 4 and 5 should be used for the AI only.

Here's what you do:
Write pseudocode, this will help you find out EXACTLY what you want. Start simple, just getting the very basics down.
Next, start coding. This will be mostly switching out what you just did with actual code, but you may run into a few bumps.
Once you get a working algorithm, you can refine it. A big part will be your definition of "best outcome."



None.

Jun 11 2008, 3:44 pm InsolubleFluff Post #3



I will post code up later tonight and you can see what im trying to do.



None.

Jun 12 2008, 12:41 am InsolubleFluff Post #4



Sorry for the huge lines of code next:

Code
/**
* Write a description of class GUI here.
*
* @author (your name)
* @version (a version number or a date)
*/

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.awt.Color;

public class GUI
{
   private final static int WSIZEW = 428;
   private final static int WSIZEH = 628;
   
   public static void main(String[] args)
   {
       JFrame frame = new JFrame();
       frame.setTitle("Blob Wars");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
       frame.setSize(WSIZEW, WSIZEH);
       IPanel panel = new IPanel(WSIZEW, WSIZEH);
       panel.setBackground(Color.white);
       frame.setResizable(false);
       frame.setContentPane(panel);
       frame.show(true);
       frame.setVisible(true);
   }  
}

class IPanel extends JPanel implements MouseListener, MouseMotionListener
{
   private final static int BSIZE = 400;
   private final static int GridResolution = 8;
   private final static int GRID = BSIZE / GridResolution;
   private static int menu = 0; //Stage of menu. 0 = Main Menu, 1 = Board Selection (1p game OR 2p game), 2 = Instructions, 3 = in game
   private static int board = 1; //Which board to display in Board Selection / which Board to use in game
   private static int player; //Number of players (1p game or 2p game)
   private static int turn = 1; //Players turn (player 1's turn or player 2's turn)
   private static int gameOver; //0 = No Winners, 1 = P1 Wins, 2 = P2 wins
   private static int selectX; //x co-ordinate of blob selected (used for jumping)
   private static int selectY; //y co-ordinate of blob selected (used for jumping)
   private Board b; //Decleration of Board object named b
   private Font f = new Font("Arial",Font.BOLD,30);
   IPanel(int Window_SizeW, int Window_SizeH){
   addMouseListener(this);
   } // end IPanel() constructor

   public void paintComponent(Graphics g){
       super.paintComponent(g);
       drawGame(g);
   } // end paintComponent      
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
   private void drawGame(Graphics g){
       if(menu == 0){
           drawMenu(g);
       }
       else if(menu == 1){
           drawBoardOptions(g);
       }
       else if(menu == 2){
           drawInstructions(g);
       }
       else{
           int x=10;
           int y=10;
           g.setColor(Color.black);
           for(x = 10; x <= BSIZE + 10; x += GRID){
               g.drawLine(x, y, x, y + BSIZE);
           }
           x=10;
           for (y = 10; y <= BSIZE + 10; y += GRID){
               g.drawLine(x, y, x + BSIZE, y);
           }
           drawOptions(g);
           drawBoard(g);
           drawWinLose(g);
           if(turn == 2 && player == 1){
               b.AI();
               repaint();
           }
       }
   }// end drawGrid()
   
   private void drawMenu(Graphics g){
       Toolkit Kit = Toolkit.getDefaultToolkit();
       Image p1_Image = Kit.getImage("players1.png");
       Image p2_Image = Kit.getImage("players2.png");
       Image instruction_Image = Kit.getImage("instructions.png");
       
       g.drawImage(p1_Image, 114, 50, this);
       g.drawImage(p2_Image, 114, 200, this);
       g.drawImage(instruction_Image, 65, 350, this);
   }// end drawMenu()
   
   private void drawBoard(Graphics g){
       Toolkit Kit = Toolkit.getDefaultToolkit();
       Image null_Image = Kit.getImage("nullSpace.png");
       Image adj_Image = Kit.getImage("adjacentSpace.png");
       Image jump_Image = Kit.getImage("jumpSpace.png");
       Image red_Image = Kit.getImage("redBlob.png");
       Image blue_Image = Kit.getImage("blueBlob.png");
       int tempArray[][] = b.getArray();
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(tempArray[i][j] == 1){
                   g.drawImage(null_Image, (i*50)+11, (j*50)+11, this);
               }
               else if(tempArray[i][j] == 2){
                   g.drawImage(red_Image, (i*50)+11, (j*50)+11, this);
               }
               else if(tempArray[i][j] == 3){
                   g.drawImage(blue_Image, (i*50)+11, (j*50)+11, this);
               }
               else if(tempArray[i][j] == 4){
                   g.drawImage(jump_Image, (i*50)+11, (j*50)+11, this);
               }
               else if(tempArray[i][j] == 5){
                   g.drawImage(adj_Image, (i*50)+11, (j*50)+11, this);
               }
           }
       }
       repaint();
   }// end drawBoard()
   
   private void drawBoardOptions(Graphics g){
       Toolkit Kit = Toolkit.getDefaultToolkit();
       Image b1_Image = Kit.getImage("b1.png");
       Image b2_Image = Kit.getImage("b2.png");
       Image b3_Image = Kit.getImage("b3.png");
       Image b4_Image = Kit.getImage("b4.png");
       Image ok_Image = Kit.getImage("ok.png");
       Image board1_Image = Kit.getImage("board1.png");
       Image board2_Image = Kit.getImage("board2.png");
       Image board3_Image = Kit.getImage("board3.png");
       Image board4_Image = Kit.getImage("board4.png");
       Image main_Image = Kit.getImage("MainMenu.png");
       g.drawImage(b1_Image, 39, 50, this);
       g.drawImage(b2_Image, 139, 50, this);
       g.drawImage(b3_Image, 239, 50, this);
       g.drawImage(b4_Image, 339, 50, this);
       g.drawImage(ok_Image, 164, 400, this);
       g.drawImage(main_Image, 65, 475, this);
       
       if(board == 1){
           g.drawImage(board1_Image, 114, 150, this);
       }
       else if(board == 2){
           g.drawImage(board2_Image, 114, 150, this);
       }
       else if(board == 3){
           g.drawImage(board3_Image, 114, 150, this);
       }
       else{
           g.drawImage(board4_Image, 114, 150, this);
       }
   }// end drawBoardOptions()
   
   private void drawInstructions(Graphics g){
       Toolkit Kit = Toolkit.getDefaultToolkit();
       Image instructs_Image = Kit.getImage("instructs.png");
       Image main_Image = Kit.getImage("MainMenu.png");
       g.drawImage(instructs_Image, 65, 150, this);
       g.drawImage(main_Image, 65, 475, this);
   }// end drawInstructions()
   
   private void drawOptions(Graphics g){
       Toolkit Kit = Toolkit.getDefaultToolkit();
       Image pass_Image = Kit.getImage("Pass.png");
       Image quit_Image = Kit.getImage("Quit.png");
       g.drawImage(pass_Image, 40, 475, this);
       g.drawImage(quit_Image, 240, 475, this);
   }
   private void drawWinLose(Graphics g){
       g.setFont(f);
       if(gameOver == 0 && turn == 1){
           g.setColor(Color.red);
           g.drawString("Player 1's Turn",100,450);
       }
       else if(gameOver == 0 && turn == 2){
           g.setColor(Color.blue);
           g.drawString("Player 2's Turn",100,450);
       }
       else if(gameOver == 1){
           g.setColor(Color.red);
           g.drawString("Player 1 Wins!",100,450);
       }
       else{
           g.setColor(Color.blue);
           g.drawString("Player 2 Wins!",100,450);
       }
   }
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // //
   public void mousePressed(MouseEvent evt) {
       if(menu == 3){
           int mX = evt.getX()/50;
           int mY = evt.getY()/50;
           if(mX > 7){mX = 7;}
           if(mY > 7){mY = 7;}
           int tempArray[][] = b.getArray();
           if(tempArray[mX][mY] == 2 && turn == 1){
               b.clearArray();
               b.checkArray(mX, mY);
               selectX = mX;
               selectY = mY;
           }
           if(tempArray[mX][mY] == 3 && turn == 2 && player == 2){
               b.clearArray();
               b.checkArray(mX, mY);
               selectX = mX;
               selectY = mY;
           }
           if(tempArray[mX][mY] == 5 && turn == 1){
               b.setArray(mX, mY, 2, selectX, selectY, 1);
               b.clearArray();
               turn = 2;                
           }
           if(tempArray[mX][mY] == 5 && turn == 2 && player == 2){
               b.setArray(mX, mY, 3, selectX, selectY, 1);
               b.clearArray();
               turn = 1;
           }
           if(tempArray[mX][mY] == 4 && turn == 1){
               b.setArray(mX, mY, 2, selectX, selectY, 2);
               b.clearArray();
               turn = 2;
           }
           if(tempArray[mX][mY] == 4 && turn == 2 && player == 2){
               b.setArray(mX, mY, 3, selectX, selectY, 2);
               b.clearArray();
               turn = 1;
           }
           gameOver = b.checkWin();
       }
   }//end mousePressed    
   
   public void mouseClicked(MouseEvent evt){        
       int mX = evt.getX();
       int mY = evt.getY();
       if(mX > 114 && mX < 314 && mY > 50 && mY < 150 && menu == 0){menu = 1; player = 1;}//1 Player Game Button
       else if(mX > 114 && mX < 314 && mY > 200 && mY < 300 && menu == 0){menu = 1; player = 2;}//2 Player Game Button
       else if(mX > 114 && mX < 314 && mY > 350 && mY < 450 && menu == 0){menu = 2;}//Instructions Button
       else if(mX > 39 && mX < 89 && mY > 50 && mY < 100 && menu == 1){board = 1;}//Board 1 Button
       else if(mX > 139 && mX < 189 && mY > 50 && mY < 100 && menu == 1){board = 2;}//Board 2 Button
       else if(mX > 239 && mX < 289 && mY > 50 && mY < 100 && menu == 1){board = 3;}//Board 3 Button
       else if(mX > 339 && mX < 389 && mY > 50 && mY < 100 && menu == 1){board = 4;}//Board 4 Button
       else if(mX > 65 && mX < 365 && mY > 500 && mY < 600 && menu != 3){menu = 0; board = 1;}//Main Menu Button
       else if(mX > 164 && mX < 264 && mY > 400 && mY < 450 && menu == 1){menu = 3; b = new Board(board);}//OK Button
       else if(mX > 40 && mX < 190 && mY > 475 && mY < 575 && menu == 3){if(turn==1){turn = 2;}else{turn = 1;};}//Pass Button
       else if(mX > 240 && mX < 390 && mY > 475 && mY < 575 && menu == 3){menu = 0; board = 1; turn = 1;}//Quit Button
       repaint();
   } //end mouseClicked
   
   public void mouseReleased(MouseEvent evt) { } //Not-needed mouse event
   public void mouseDragged(MouseEvent evt) {} //Not-needed mouse event
   public void mouseMoved(MouseEvent evt) { } //Not-needed mouse event
   public void mouseEntered(MouseEvent evt) { } //Not-needed mouse event
   public void mouseExited(MouseEvent evt) { } //Not-needed mouse event    
}




None.

Jun 12 2008, 12:41 am InsolubleFluff Post #5



Code
public class Board
{
   public int x=3; //X position of best possible move (AI)
   public int y=4; //Y position of best possible move (AI)
   public int curMost; //Current best option.
   public int boardArray[][] = new int[8][8];
   public Board(int boardType){
       if(boardType == 1){
           for(int i = 0; i < 8; i++){
               for(int j = 0; j < 8; j++){
                   boardArray[i][j] = 0;
               }
           }
           //Players
           boardArray[0][6] = 2;
           boardArray[7][0] = 2;
           boardArray[0][7] = 3;
           boardArray[7][7] = 3;
       }
       if(boardType == 2){
           for(int i = 0; i < 8; i++){
               for(int j = 0; j < 8; j++){
                   boardArray[i][j] = 0;
               }
           }
           //Players
           boardArray[0][0] = 2;
           boardArray[7][0] = 2;
           boardArray[0][7] = 3;
           boardArray[7][7] = 3;        
           //Null Tiles
           boardArray[2][2] = 1;
           boardArray[2][5] = 1;
           boardArray[3][3] = 1;
           boardArray[3][4] = 1;
           boardArray[4][3] = 1;
           boardArray[4][4] = 1;
           boardArray[5][2] = 1;
           boardArray[5][5] = 1;
       }
       if(boardType == 3){
           for(int i = 0; i < 8; i++){
               for(int j = 0; j < 8; j++){
                   boardArray[i][j] = 0;
               }
           }
           //Players
           boardArray[0][0] = 2;
           boardArray[7][0] = 2;
           boardArray[0][7] = 3;
           boardArray[7][7] = 3;          
           //Null Tiles
           boardArray[0][1] = 1;
           boardArray[0][6] = 1;
           boardArray[1][1] = 1;
           boardArray[1][6] = 1;
           boardArray[3][3] = 1;
           boardArray[3][4] = 1;
           boardArray[4][3] = 1;
           boardArray[4][4] = 1;
           boardArray[6][1] = 1;
           boardArray[6][6] = 1;
           boardArray[7][1] = 1;
           boardArray[7][6] = 1;
       }
       if(boardType == 4){
           for(int i = 0; i < 8; i++){
               for(int j = 0; j < 8; j++){
                   boardArray[i][j] = 0;
               }
           }
           //Players
           boardArray[1][0] = 2;
           boardArray[6][0] = 2;
           boardArray[1][7] = 3;
           boardArray[6][7] = 3;            
           //Null Tiles
           boardArray[0][0] = 1;
           boardArray[0][7] = 1;
           boardArray[2][5] = 1;
           boardArray[3][4] = 1;
           boardArray[4][3] = 1;
           boardArray[5][2] = 1;
           boardArray[7][0] = 1;
           boardArray[7][7] = 1;
       }
   }
   
   public void display(){
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(boardArray[i][j] == 0){
                   System.out.print("[ ]");
               }
               else if(boardArray[i][j] == 1){
                   System.out.print("[x]");
               }
               else if(boardArray[i][j] == 2){
                   System.out.print("[r]");
               }
               else if(boardArray[i][j] == 3){
                   System.out.print("[b]");
               }
               else if(boardArray[i][j] == 5){
                   System.out.print("[a]");
               }
           }
           System.out.println();
       }
   }
   
   public int[][] getArray(){
       return boardArray;
   }
   
   public int[][] checkArray(int mX, int mY){
       if(mX > 1 && mY > 1 && boardArray[mX - 2][mY - 2] == 0){boardArray[mX -2][mY -2] = 4;}
       if(mX > 1 && mY > 0 && boardArray[mX - 2][mY - 1] == 0){boardArray[mX -2][mY -1] = 4;}
       if(mX > 1 && boardArray[mX - 2][mY] == 0){boardArray[mX -2][mY] = 4;}
       if(mX > 1 && mY < 7 && boardArray[mX - 2][mY + 1] == 0){boardArray[mX -2][mY +1] = 4;}
       if(mX > 1 && mY < 6 && boardArray[mX - 2][mY + 2] == 0){boardArray[mX -2][mY +2] = 4;}
       
       if(mX > 0 && mY > 1 && boardArray[mX - 1][mY - 2] == 0){boardArray[mX -1][mY -2] = 4;}
       if(mX > 0 && mY > 0 && boardArray[mX - 1][mY - 1] == 0){boardArray[mX -1][mY -1] = 5;}
       if(mX > 0 && boardArray[mX - 1][mY] == 0){boardArray[mX -1][mY] = 5;}
       if(mX > 0 && mY < 7 && boardArray[mX - 1][mY + 1] == 0){boardArray[mX -1][mY +1] = 5;}
       if(mX > 0 && mY < 6 && boardArray[mX - 1][mY + 2] == 0){boardArray[mX -1][mY +2] = 4;}
       
       if(mY > 1 && boardArray[mX][mY - 2] == 0){boardArray[mX][mY -2] = 4;}
       if(mY > 0 && boardArray[mX][mY - 1] == 0){boardArray[mX][mY -1] = 5;}
       if(mY < 7 && boardArray[mX][mY + 1] == 0){boardArray[mX][mY +1] = 5;}
       if(mY < 6 && boardArray[mX][mY + 2] == 0){boardArray[mX][mY +2] = 4;}
       
       if(mX < 7 && mY > 1 && boardArray[mX + 1][mY - 2] == 0){boardArray[mX +1][mY -2] = 4;}
       if(mX < 7 && mY > 0 && boardArray[mX + 1][mY - 1] == 0){boardArray[mX +1][mY -1] = 5;}
       if(mX < 7 && boardArray[mX + 1][mY] == 0){boardArray[mX +1][mY] = 5;}
       if(mX < 7 && mY < 7 && boardArray[mX + 1][mY + 1] == 0){boardArray[mX +1][mY +1] = 5;}
       if(mX < 7 && mY < 6 && boardArray[mX + 1][mY + 2] == 0){boardArray[mX +1][mY +2] = 4;}
       
       if(mX < 6 && mY > 1 && boardArray[mX + 2][mY - 2] == 0){boardArray[mX +2][mY -2] = 4;}
       if(mX < 6 && mY > 0 && boardArray[mX + 2][mY - 1] == 0){boardArray[mX +2][mY -1] = 4;}
       if(mX < 6 && boardArray[mX + 2][mY] == 0){boardArray[mX +2][mY] = 4;}
       if(mX < 6 && mY < 7 && boardArray[mX + 2][mY + 1] == 0){boardArray[mX +2][mY +1] = 4;}
       if(mX < 6 && mY < 6 && boardArray[mX + 2][mY + 2] == 0){boardArray[mX +2][mY +2] = 4;}
       return boardArray;
   }
   
   public int[][] setArray(int mX, int mY, int x, int selectX, int selectY, int type){
           boardArray[mX][mY] = x;
           if(mX > 0 && mY > 0 && (boardArray[mX-1][mY-1] == 2 || boardArray[mX-1][mY-1] == 3)){boardArray[mX-1][mY-1] = x;}
           if(mX > 0 && (boardArray[mX-1][mY] == 2 || boardArray[mX-1][mY] == 3)){boardArray[mX-1][mY] = x;}
           if(mX > 0 && mY < 7 && (boardArray[mX-1][mY+1] == 2 || boardArray[mX-1][mY+1] == 3)){boardArray[mX-1][mY+1] = x;}
           
           if(mY > 0 && (boardArray[mX][mY-1] == 2 || boardArray[mX][mY-1] == 3)){boardArray[mX][mY-1] = x;}
           if(mY < 7 && (boardArray[mX][mY+1] == 2 || boardArray[mX][mY+1] == 3)){boardArray[mX][mY+1] = x;}
           
           if(mX < 7 && mY > 0 && (boardArray[mX+1][mY-1] == 2 || boardArray[mX+1][mY-1] == 3)){boardArray[mX+1][mY-1] = x;}
           if(mX < 7 && (boardArray[mX+1][mY] == 2 || boardArray[mX+1][mY] == 3)){boardArray[mX+1][mY] = x;}
           if(mX < 7 && mY < 7 && (boardArray[mX+1][mY+1] == 2 || boardArray[mX+1][mY+1] == 3)){boardArray[mX+1][mY+1] = x;}
       if(type == 2){
           boardArray[mX][mY] = x;
           boardArray[selectX][selectY] = 0;
       }
       return boardArray;
   }
   public void checkAdj(){
       int tempMost = 0;
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(boardArray[i][j] == 4 || boardArray[i][j] == 5){
                   int mX = i;
                   int mY = j;
                   if(mX > 0 && mY > 0 && (boardArray[mX-1][mY-1] == 2 || boardArray[mX-1][mY-1] == 3)){tempMost++;}
                   if(mX > 0 && (boardArray[mX-1][mY] == 2 || boardArray[mX-1][mY] == 3)){tempMost++;}
                   if(mX > 0 && mY < 7 && (boardArray[mX-1][mY+1] == 2 || boardArray[mX-1][mY+1] == 3)){tempMost++;}
                   
                   if(mY > 0 && (boardArray[mX][mY-1] == 2 || boardArray[mX][mY-1] == 3)){tempMost++;}
                   if(mY < 7 && (boardArray[mX][mY+1] == 2 || boardArray[mX][mY+1] == 3)){tempMost++;}
                   
                   if(mX < 7 && mY > 0 && (boardArray[mX+1][mY-1] == 2 || boardArray[mX+1][mY-1] == 3)){tempMost++;}
                   if(mX < 7 && (boardArray[mX+1][mY] == 2 || boardArray[mX+1][mY] == 3)){tempMost++;}
                   if(mX < 7 && mY < 7 && (boardArray[mX+1][mY+1] == 2 || boardArray[mX+1][mY+1] == 3)){tempMost++;}
                   if(tempMost > curMost){
                       x = mX;
                       y = mY;
                   }
               }
           }
       }
   }
   
   public int[][] clearArray(){
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(boardArray[i][j] == 4){boardArray[i][j] = 0;}
               if(boardArray[i][j] == 5){boardArray[i][j] = 0;}
           }
       }
       return boardArray;
   }
   
   public int checkWin(){
       int p1 = 0;
       int p2 = 0;
       boolean full = true;
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(boardArray[i][j] == 0){full = false;}
               if(boardArray[i][j] == 2){p1++;}
               if(boardArray[i][j] == 3){p2++;}
               if(boardArray[i][j] == 4){full = false;}
               if(boardArray[i][j] == 5){full = false;}
           }
       }
       if(p1 == 0){
           return 2;
       }
       else if(p2 == 0){
           return 1;
       }
       else if(full == true){
           if(p1 > p2){return 1;}
           else{return 2;}
       }
       else{
           return 0;
       }
   }  
   public void AI(){
       for(int i = 0; i < 8; i++){
           for(int j = 0; j < 8; j++){
               if(boardArray[i][j] == 3){
                   checkArray(i,j);
                   checkAdj();
               }
           }
       }
       boardArray[x][y] = 3;
       setArray(x,y,3,x,y,1);
       clearArray();
   }  
}

Those are seperated by Classes btw.I worked on the AI at school, it now goes to EVERY spot.
The only thing I really need assistance with is the Board Class's AI method and the checkAdj(); method.I know for a fact clearArray(); works as supposed and so does the checkArray method and so does the setArray(); method, i just need to figure out how to use them all together and make the AI work o.o



None.

Jun 12 2008, 7:34 pm InsolubleFluff Post #6



did anyone copy and paste this yet and see what im aiming for?



None.

Jun 13 2008, 5:00 am InsolubleFluff Post #7



This is due tomorrow, so any input before 12:10 tomorrow is great, thanks.



None.

Jun 13 2008, 5:11 am DT_Battlekruser Post #8



What you described should be extremely easy to code, just change your words into syntax. However, it sounds like a brute-force approach (check all possible moves and results and find the best outcome), which is rarely the point of writing an AI. Would a simpler (if "dumb"-er) approach be acceptable?



None.

Jun 13 2008, 11:01 am InsolubleFluff Post #9



sure?
I really just need to make a simple AI algorithm by 12:10 today o.o



None.

Jun 13 2008, 4:27 pm frazz Post #10



SEN is not the best place to get fast cheats.

I'm sure the brute force method will work fine. I doubt you had time to study the game and look for patterns that show when good moves are available.
Also, your code is huge. I hope that contains the programming for the whole game, not just the AI.



None.

Jun 13 2008, 4:29 pm InsolubleFluff Post #11



It's the whole game, you'd know that if you actually copied and pasted that...
I am not asking for cheats, simply guidance in the direction I need to take.
I'm about to present so it's too late now.
Somebody could close this topic now, you've proven to be little assistance :l



None.

Jun 13 2008, 6:32 pm frazz Post #12



Of course I didn't, Shocko.

Good luck!



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:13 pm]
No-Name-Needed-II -- Zoan you mentioned making kotk maps.. I've got a 110% fully polished up terrain I've been sitting on since 2019.. I'm more a painter than a poet, I've got no storyline to do it justice so if you or anyone else want to check it out MSG me.. If no takers than I'll probably just upload it to terrain genre in a few days.. SCBW is running outa lifespan so i'm at that point where little gems I've got will never see the light of day otherwise ;(
[12:24 pm]
Ultraviolet -- Zoan
Zoan shouted: TheHappy115 Oh, I mentioned in a thread but not the shoutbox, but it does work if you run SC in 32bit as suggested by Butch.
I found 64-bit SC broke all sorts of stuff, I never liked it
[12:21 pm]
No-Name-Needed-II -- Zoan Could it have something to do with the turn rate? I found recently the hard way that when I have too many unit orders triggered at once with hyper triggers on "I think it was Dynamic" It caused a crash similar to an EUD crash on non-eud maps.. -Also when does the map crash?? does it crash after briefing at start of game??? or does it crash when you use a spell???
[07:35 am]
MINT_H -- Map Upload
[02:42 am]
Zoan -- TheHappy115
TheHappy115 shouted: I had played spellsword on Remastered roughly 3 - 4 years and it worked fine so not sure why it doesn't work now. Big Rips. I know there is some form of trigger that detects whether its online or not but I imagine it has something to due with latency
Oh, I mentioned in a thread but not the shoutbox, but it does work if you run SC in 32bit as suggested by Butch.
[08:53 pm]
TheHappy115 -- such as things like Center View work differently on online play (instant on online while single moves the screen slowly and pauses)
[08:52 pm]
TheHappy115 -- I had played spellsword on Remastered roughly 3 - 4 years and it worked fine so not sure why it doesn't work now. Big Rips. I know there is some form of trigger that detects whether its online or not but I imagine it has something to due with latency
[2022-5-23. : 10:53 pm]
Butch -- prob some weird character on a string somewhere or something dumb like that
[2022-5-23. : 9:50 pm]
Ultraviolet -- It's weird indeed, not really sure what is so special about Spellsword that causes it to react differently on Remastered, usually EUDs are the cause of things like that
[2022-5-23. : 5:35 pm]
Zoan -- I haven't played in like 2 years so maybe something changed I don't know about
Please log in to shout.


Members Online: Roy, Oh_Man, jun3hong