initial commit
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 897 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 424 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.2 KiB |
|
@ -0,0 +1,10 @@
|
||||||
|
class Gate {
|
||||||
|
constructor(type) {
|
||||||
|
switch (type) {
|
||||||
|
case 'logic':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
class Not {
|
||||||
|
constructor() {
|
||||||
|
this.inputs = 1;
|
||||||
|
this.outputs = 1;
|
||||||
|
this.values = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
calculate() {
|
||||||
|
if (this.values && this.inputs == this.outputs) {
|
||||||
|
|
||||||
|
for (let i= 0; i < this.values.length; i++) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 50 KiB |
|
@ -0,0 +1,14 @@
|
||||||
|
<script src="p5.min.js"></script>
|
||||||
|
<script src="sketch.js"></script>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Logic gate simulator</title>
|
||||||
|
</head>
|
||||||
|
<body style="margin: 0;">
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,26 @@
|
||||||
|
//preload images
|
||||||
|
function preload() {
|
||||||
|
and = loadImage('assets/and.png');
|
||||||
|
not = loadImage('assets/not.png');
|
||||||
|
or = loadImage('assets/or.png');
|
||||||
|
xor = loadImage('assets/xor.png');
|
||||||
|
nand = loadImage('assets/nand.png');
|
||||||
|
nor = loadImage('assets/nor.png');
|
||||||
|
on = loadImage('assets/on.png');
|
||||||
|
off = loadImage('assets/off.png');
|
||||||
|
lon = loadImage('assets/lon.png');
|
||||||
|
loff = loadImage('assets/loff.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
createCanvas(displayWidth, displayHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
background(0);
|
||||||
|
stroke(255);
|
||||||
|
}
|
||||||
|
|
||||||
|
function mousePressed() {
|
||||||
|
|
||||||
|
}
|