*****......SALUDOS!!...BIENVENIDOS.....*****

Systemkiricorp!

FORO ACTIVO

HOLA!! A TODA LA COMUNIDAD DE PROGRAMADORES
Este foro es presentado por sk
LA MATERIA DE INTELIGENCIA ARTIFICIAL

INNOVANDO Y RECREANDO IDEAS PARA LA VIDA

INICIANDO

El hombre cada dia es mejor

¿QUE ES LA INTELIGENCIA ARTIFICIAL?


Él termino "inteligencia artificial" fue acuñado formalmente en 1956 durante la conferencia de Darthmounth, más para entonces ya se había estado trabajando en ello durante cinco años en los cuales se había propuesto muchas definiciones distintas que en ningún caso habían logrado ser aceptadas totalmente por la comunidad investigadora. La AI es una de las disciplinas más nuevas que junto con la genética moderna es el campo en que la mayoría de los científicos " más les gustaría trabajar".

martes, 6 de abril de 2010

ACT250310-2-ESTRUCTURAAGENTECONARREGLOS-ADAYA MORALES ERIC-MARTINEZ HERNANDEZ JUAN CARLOS-ERIKA MAGAILI MORALES TINIDAD










CODIGO FUENTE
import javax.swing.JOptionPane;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* JFrame_LIMAGENTE.java
*
* Created on 5/04/2010, 05:23:57 PM
*/

/**
*
* @author Administrador
*/
public class JFrame_LIMAGENTE extends javax.swing.JFrame {

/** Creates new form JFrame_LIMAGENTE */

public JFrame_LIMAGENTE() {
initComponents();

}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jButton1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jSeparator1 = new javax.swing.JSeparator();
jTextField1 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jSeparator2 = new javax.swing.JSeparator();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(204, 204, 204));

jButton1.setText("Iniciar");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jPanel1.setBackground(new java.awt.Color(0, 255, 51));
jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(66, 66, 66)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(85, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)
);

jLabel1.setFont(new java.awt.Font("Arial Black", 1, 18));
jLabel1.setText("Super Agente limpiador con un arreglo ");

jLabel2.setFont(new java.awt.Font("Arial Black", 1, 18));
jLabel2.setText("Area De Simulacion");

jLabel3.setFont(new java.awt.Font("Arial Black", 1, 18));
jLabel3.setText("Persepcion");

jButton2.setText("Limpiar valor");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jLabel4.setFont(new java.awt.Font("Tahoma", 0, 8));
jLabel4.setText("Todos los derechos reservados por sk!");

jLabel5.setText("Datos de Simulacion");

jLabel6.setText("0=Sucio");

jLabel7.setText("1=limpia");

jLabel8.setText(".");

jLabel9.setText("Lado \"b\"");

jLabel10.setText("Resultado");

jLabel11.setText("Estado inicial del AGENTE");

jLabel12.setText("Apagado");

jLabel13.setText("3=basura");

jLabel14.setText("4=escombro");

jLabel15.setText("2=polvo");

jLabel16.setText("5=agua");

jPanel2.setBackground(new java.awt.Color(255, 0, 255));
jPanel2.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(255, 255, 0)));
jPanel2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 42, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 40, Short.MAX_VALUE)
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 295, Short.MAX_VALUE)
.addComponent(jLabel2)
.addGap(275, 275, 275))
.addGroup(layout.createSequentialGroup()
.addGap(83, 83, 83)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(jLabel12)
.addGap(18, 18, 18)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7)
.addComponent(jLabel6)
.addComponent(jLabel15))
.addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel5)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jLabel16)
.addComponent(jLabel13))
.addGap(193, 193, 193)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(183, 183, 183)
.addComponent(jLabel8))
.addGroup(layout.createSequentialGroup()
.addGap(84, 84, 84)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(190, 190, 190)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(181, 181, 181)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(44, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(507, Short.MAX_VALUE)
.addComponent(jLabel10)
.addGap(394, 394, 394))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(308, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel9)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addGap(13, 13, 13))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(10, 10, 10)
.addComponent(jLabel11)
.addGap(1, 1, 1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(101, 101, 101)
.addComponent(jLabel15))
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(63, 63, 63)
.addComponent(jLabel8)
.addGap(20, 20, 20))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addGap(44, 44, 44)
.addComponent(jLabel2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jLabel14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel16))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(50, 50, 50)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);

pack();
}//


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:


int x,pas,i,j,pas2;
String persepcion,resul =" ";
//extrallendo valos del tex
persepcion=jTextField1.getText();
x=Integer.parseInt(persepcion);
pas=resEstado(x);


if(pas==00){
jPanel2.setLocation(630,120);
jTextField3.setText("La zona ya esta Limpia");
JOptionPane.showMessageDialog(null,"La zona ya esta Limpia","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

pas2=mejorsolucion(pas);
}

if(pas==11){
jPanel2.setLocation(670,90);
jTextField3.setText("No hay que hacer nada por que esta limpio");
JOptionPane.showMessageDialog(null,"No hay que hacer nada","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

}
if(pas==12){
jPanel2.setLocation(630,130);
jTextField3.setText("Zona ya ha sido limpiadoa de polvo ");
JOptionPane.showMessageDialog(null,"solo hay que limpiar el polvo","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

}
if(pas==13){
jPanel2.setLocation(670,130);
jTextField3.setText("Hay que recoger la basura conforme su tipo");
JOptionPane.showMessageDialog(null,"la zona 4 esta libre de basura","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

}
if(pas==14){
jPanel2.setLocation(680,130);
jTextField3.setText("El esconbro es un desecho muy contaminate");
JOptionPane.showMessageDialog(null,"Escombro retirado","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

}
if(pas==15){
jPanel2.setLocation(650,120);
jTextField3.setText("No hay que hacer nada");
JOptionPane.showMessageDialog(null,"no puedo hacer nada","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);

}




}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(" ");
jTextField2.setText(" ");
jPanel2.setLocation(69,59);
JOptionPane.showMessageDialog(null,"Valores Borrados","Ejemplo de agente simple primer parcial",JOptionPane.PLAIN_MESSAGE);
// TODO add your handling code here:
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrame_LIMAGENTE().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration
public static int resEstado(int res1){
int resFx;
resFx=0;
if(res1==0){
resFx=00;
}
if(res1==1){
resFx=11;
}
if(res1==2){
resFx=12;
}
if(res1==3){
resFx=13;
}
if(res1==4){
resFx=14;
}
if(res1==5){
resFx=15;
}

return resFx;

}

public static int mejorsolucion(int res1){
String Msolucion[]={"Nohacernada","Limpiar","Liampiaragua","recogerbasura","detectectopolvo","sacudo"};
int accion=0,j;
String resf=" ";
for(j=0;j<=1;j++){

resf+=Msolucion[j]+" ";
}
return accion;

}

}

No hay comentarios:

Publicar un comentario