Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d5917ba
s
KentVejrupMadsen Jul 24, 2022
616025b
working on code
KentVejrupMadsen Jul 24, 2022
af43339
removed .idea/*
KentVejrupMadsen Jul 24, 2022
7801d98
2d
KentVejrupMadsen Jul 24, 2022
1ebb167
current state
KentVejrupMadsen Jul 25, 2022
89408ed
current state
KentVejrupMadsen Jul 25, 2022
b87fdfb
current state
KentVejrupMadsen Jul 25, 2022
795d2d1
renaming stuff
KentVejrupMadsen Jul 25, 2022
88c486b
moved canvas into it's own folder
KentVejrupMadsen Jul 25, 2022
d58efc4
weird issues
KentVejrupMadsen Jul 25, 2022
5ba7340
current
KentVejrupMadsen Jul 25, 2022
1a8b7d3
added attributes
KentVejrupMadsen Jul 25, 2022
289b2a2
current
KentVejrupMadsen Jul 25, 2022
3b08337
current
KentVejrupMadsen Jul 25, 2022
73d1831
current
KentVejrupMadsen Jul 26, 2022
d663dc4
c
KentVejrupMadsen Jul 26, 2022
124d16c
s
KentVejrupMadsen Jul 26, 2022
3b5f903
still working at it
KentVejrupMadsen Jul 26, 2022
63a965d
updating license
KentVejrupMadsen Jul 26, 2022
3a7d457
adding attribute
KentVejrupMadsen Jul 26, 2022
cc55474
installed grunt.js and nodemon
KentVejrupMadsen Jul 26, 2022
c583363
removed package-lock
KentVejrupMadsen Jul 26, 2022
9bcdb2e
working on grunt
KentVejrupMadsen Jul 26, 2022
e088838
adding structure
KentVejrupMadsen Jul 26, 2022
3f50ddd
working
KentVejrupMadsen Jul 26, 2022
65cd6dc
c
KentVejrupMadsen Jul 26, 2022
1ca75be
27-07-2022
KentVejrupMadsen Jul 27, 2022
f731738
c
KentVejrupMadsen Jul 27, 2022
998d963
working
KentVejrupMadsen Jul 27, 2022
b4f9825
added git attributes
KentVejrupMadsen Aug 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Default for all
* text=auto

*.md diff=markdown eol=crlf

*.sh diff=sh eol=lf
*.js diff=text eol=lf
*.java diff=java eol=crlf

# Git attributes
.gitignore text eol=lf
.gitattributes text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/Codespace.JavaScript.iml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/watcherTasks.xml

This file was deleted.

File renamed without changes.
87 changes: 87 additions & 0 deletions AI/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
Home
</title>

<meta http-equiv="refresh" content="15">
</head>
<body>
<header>

</header>
<main>
<div>
<canvas id="mainCanvas" width="720" height="400" class="r180deg">
</canvas>
</div>

<div id="diagram">
<h4> Diagram </h4>
<div id="diagram_values">

</div>
</div>

<div id="statistics">
<h4> Statistics </h4>
<div id="statistics_values">

</div>
</div>

</main>
<footer>

</footer>
</body>

<script src="scripts/math/vector.js">
</script>

<script src="scripts/intelligence/train.js" >
</script>

<script src="scripts/functions.js">
</script>

<script src="scripts/intelligence/neurons.js">
</script>

<script src="scripts/diagram/diagram_mouseEvents.js">
</script>

<script src="scripts/diagram/diagram_axis.js">
</script>

<script src="scripts/diagram/diagram_grid.js">
</script>


<script src="scripts/diagram/diagrams_color.js">
</script>

<script src="scripts/diagram/diagram.js" >
</script>

<script src="scripts/diagram/diagram_graph.js" >
</script>

<script src="scripts/diagram/elements/nodeElements.js" >
</script>

<script src="scripts/diagram/elements/nodeNetwork.js" >
</script>

<script src="scripts/intelligence/network.js" >
</script>

<script src="scripts/code.js">
</script>


<link rel="stylesheet"
href="scss/style.css" >
</html>
36 changes: 36 additions & 0 deletions AI/scripts/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
let diagram = null;

let lock = false;


function onSizeChange( e )
{
if( !lock )
{
lock = true;

diagram.dimensionsIsChanged = true;

lock = false;
}
}

function main()
{
diagram = new Diagram("mainCanvas" );
diagram.initialise();

draw();
}

function draw()
{
diagram.clean();
diagram.draw();

requestAnimationFrame( draw );
}

addEventListener("resize", function (e){onSizeChange(e)});

addEventListener("load", function (e){main();});
180 changes: 180 additions & 0 deletions AI/scripts/diagram/diagram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
class Diagram
{
constructor( id )
{
this.__initialise_canvas( id );
this.__initialise_mouseEvent();

this.dimensions = null;
this.dimensionsIsChanged = false;

this.origin = ZeroPositionVector.generate();

this.axis = new PresentAxis();
this.grid = new PresentGrid();

this.layers = new NodeNetwork(4, 12, 8, 3 );
this.layers.connectNeighbors();

this.useDiagram = new DiagramGraph( this.context, this.Dimensions, this.layers );
}


__initialise_mouseEvent()
{
DiagramMouseEventHandler.setup( this.document );
this.mouseEventHandler = DiagramMouseEventHandler.retrieveHandler();
}

__initialise_canvas( id )
{
this.document = document.getElementById( id );

this.document.width = window.innerWidth - 200;
this.document.height = window.innerHeight - 100;

this.context = this.document.getContext("2d" );
}




// https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height
__cache_size()
{
const width = this.document.width;
const heigth = this.document.height;

this.dimensions = new Vector( width, heigth );
}

get Layers()
{
return this.layers;
}


get Origin()
{
return this.origin;
}


get Dimensions()
{
if( this.DimensionsIsEmpty )
{
this.__cache_size();
}

return this.dimensions;
}


// Accessors
get Axis()
{
return this.axis;
}

get Grid()
{
return this.grid;
}

get Width()
{
if( this.DimensionsIsEmpty )
{
this.__cache_size();
}

return this.dimensions.X;
}

get Heigth()
{
if( this.DimensionsIsEmpty )
{
this.__cache_size();
}

return this.dimensions.Y;
}

get DimensionsIsEmpty()
{
return this.dimensions == null;
}



// Code
initialise()
{
console.log( { 'width': this.Width, 'heigth': this.Heigth } );

this.grid.Screen = this.Dimensions;
this.axis.Screen = this.Dimensions;
}

update()
{
this.__update_dimensions();

}

__calc_window_width()
{
return window.innerWidth - 100;
}

__calc_window_height()
{
return window.innerHeight - 200;
}

__update_dimensions()
{
if( this.dimensionsIsChanged )
{
const widthDimension = this.__calc_window_width();
const heightDimension = this.__calc_window_height();

this.document.width = widthDimension;
this.document.height = heightDimension;

this.dimensions.assign( widthDimension, heightDimension );

this.dimensionsIsChanged = false;
}
}

draw()
{
this.update();
this.clean();

this.mouseEventHandler.drawMouse();

this.axis.draw( this.context );
this.grid.draw( this.context );

this.useDiagram.draw();
}


clean()
{
this.clearArea( this.Origin,
this.Dimensions );
}


clearArea( pS, pE )
{
this.context.clearRect( pS.X, pS.Y,
pE.X, pE.Y );
}
}
Loading