started with the TicTacToe_MinMax Project. Finished the rendering of the game.

TODO: Make a playable version and add MinMax
This commit is contained in:
2020-06-14 23:13:33 +02:00
parent c1ebe11e2f
commit 99d9170365
145 changed files with 8952 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

11
ImageToText/src.iml Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,69 @@
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.*;
public class Keyboard {
public static void main(String args[]) throws InterruptedException {
KeyListener listener = new KeyListener() {
@Override
public void keyPressed(KeyEvent event) {
System.out.println(event.getKeyChar());
}
@Override
public void keyReleased(KeyEvent event) {
System.out.println(event.getKeyChar());
}
@Override
public void keyTyped(KeyEvent event) {
System.out.println(event.getKeyChar());
}
private void printEventInfo(String str, KeyEvent e) {
System.out.println(str);
int code = e.getKeyCode();
System.out.println(" Code: " + KeyEvent.getKeyText(code));
System.out.println(" Char: " + e.getKeyChar());
int mods = e.getModifiersEx();
System.out.println(" Mods: "
+ KeyEvent.getModifiersExText(mods));
System.out.println(" Location: "
+ keyboardLocation(e.getKeyLocation()));
System.out.println(" Action? " + e.isActionKey());
}
private String keyboardLocation(int keybrd) {
switch (keybrd) {
case KeyEvent.KEY_LOCATION_RIGHT:
return "Right";
case KeyEvent.KEY_LOCATION_LEFT:
return "Left";
case KeyEvent.KEY_LOCATION_NUMPAD:
return "NumPad";
case KeyEvent.KEY_LOCATION_STANDARD:
return "Standard";
case KeyEvent.KEY_LOCATION_UNKNOWN:
default:
return "Unknown";
}
}
};
JFrame jFrame = new JFrame();
jFrame.setSize(1000,1000);
jFrame.setVisible(true);
jFrame.addKeyListener(listener);
while(true){
Thread.sleep(1);
}
}
}

73
ImageToText/src/Test.java Normal file
View File

@@ -0,0 +1,73 @@
package src;
import org.w3c.dom.css.RGBColor;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Test extends Frame implements ActionListener {
private Label lblCount; // Declare a Label component
private TextField tfCount; // Declare a TextField component
private Button btnCount; // Declare a Button component
private int count = 0; // Counter's value
private Color c;
// Constructor to setup GUI components and event handlers
public Test () {
setLayout(new FlowLayout());
// "super" Frame, which is a Container, sets its layout to FlowLayout to arrange
// the components from left-to-right, and flow to next row from top-to-bottom.
lblCount = new Label("Counter"); // construct the Label component
add(lblCount); // "super" Frame container adds Label component
tfCount = new TextField(count + "", 5); // construct the TextField component with initial text
tfCount.setEditable(false); // set to read-only
add(tfCount); // "super" Frame container adds TextField component
btnCount = new Button("Count"); // construct the Button component
add(btnCount); // "super" Frame container adds Button component
btnCount.addActionListener(this);
// "btnCount" is the source object that fires an ActionEvent when clicked.
// The source add "this" instance as an ActionEvent listener, which provides
// an ActionEvent handler called actionPerformed().
// Clicking "btnCount" invokes actionPerformed().
setTitle("AWT Counter"); // "super" Frame sets its title
setSize(250, 100); // "super" Frame sets its initial window size
// For inspecting the Container/Components objects
// System.out.println(this);
// System.out.println(lblCount);
// System.out.println(tfCount);
// System.out.println(btnCount);
setVisible(true); // "super" Frame shows
c = new Color(150,100,25);
// System.out.println(this);
// System.out.println(lblCount);
// System.out.println(tfCount);
// System.out.println(btnCount);
}
// The entry main() method
public static void main(String[] args) {
// Invoke the constructor to setup the GUI, by allocating an instance
Test app = new Test();
// or simply "new AWTCounter();" for an anonymous instance
}
@Override
public void actionPerformed(ActionEvent e) {
++count; // Increase the counter value
// Display the counter value on the TextField tfCount
tfCount.setText(count + ""); // Convert int to String
System.out.println(c.getRGB());
c = c.brighter();
}
}

View File

@@ -0,0 +1,3 @@
public class Text{
}