-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvisualization.html
More file actions
169 lines (150 loc) · 7.05 KB
/
visualization.html
File metadata and controls
169 lines (150 loc) · 7.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Matrix-Themed Processor Logic Circuit Visualization</title>
<script type="text/javascript" src="https://gc.kis.v2.scr.kaspersky-labs.com/FD126C42-EBFA-4E12-B309-BB3FDD723AC1/main.js?attr=o0OS_lfF77KEI64uy4bUzt0YDKa3GP0037Yj-edHhsFYFFSlzhn21FfK2msngSRoPRxrxwrOkYY5aVO9QdGCw_iu_dsKEldVpKj1T2k-V9SRrlCYMMxOL8J89XtK9CmIBD00sT-cMLXVxP-AcO-tMAcmUq5p07sEIjm_MOv_cxx_2n0ZMcQgk3d1g4s26TaBXkfGx82xGVgioPjqS4VWqTIX9HLBM7e7FkyWE4PDNTVuyGF4sjYR_QErFiNjHq397WjE5zcVjvmEo5s6uI-_OQ" charset="UTF-8"></script>
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
color: #0f0;
display: grid;
justify-content: center;
align-items: center;
font-family: 'Courier New', monospace;
}
canvas {
background-color: black;
border: 1px solid #555;
margin: 20px;
max-width: calc(100% - 40px);
max-height: calc(100% - 40px);
}
</style>
</head>
<body>
<canvas id="processorCanvas"></canvas>
<script>
const canvas = document.getElementById('processorCanvas');
canvas.width = window.innerWidth - 40;
canvas.height = window.innerHeight - 40;
const ctx = canvas.getContext('2d');
// Reserved space for the message
const messageHeight = 120; // Adjust height of the reserved space
// Function to draw message
function drawMessage() {
const message = "Entire processors can be created by streamlining logic through threads you create. Symbols inside represent logic gates within processors. Companies such as Intel give their processors cool code names. In this example we gave simple logic blocks within a theoretical processor names. We can generate different processors based on task oriented prompts. In our backend we have a model that will associate the task to different processors. We achieve a whole different level of efficiency by generating processors, threads, and their code infrastructure based on their architecture and overall task.";
ctx.font = "18px 'Courier New', monospace";
ctx.fillStyle = "#0f0";
wrapText(ctx, message, 10, 25, canvas.width - 20, 20);
}
// Function to wrap text for better display
function wrapText(context, text, x, y, maxWidth, lineHeight) {
const words = text.split(' ');
let line = '';
for(let n = 0; n < words.length; n++) {
const testLine = line + words[n] + ' ';
const metrics = context.measureText(testLine);
const testWidth = metrics.width;
if (testWidth > maxWidth && n > 0) {
context.fillText(line, x, y);
line = words[n] + ' ';
y += lineHeight;
} else {
line = testLine;
}
}
context.fillText(line, x, y);
}
const compartmentNames = ["RainForest", "Lake23", "CyberStream", "QuantumField", "NeuralNet", "EchoChamber", "DataWave", "PixelStream", "Vortex", "PixieDust", "PeterPan", "StreamEncoder23"];
function getRandomName() {
return compartmentNames[Math.floor(Math.random() * compartmentNames.length)];
}
function drawLogicGate(type, x, y) {
ctx.fillStyle = '#0f0'; // Matrix green color
ctx.beginPath();
// Define different shapes for logic gates
switch (type) {
case 'AND':
ctx.rect(x, y, 20, 20); break;
case 'OR':
ctx.arc(x + 10, y + 10, 10, 0, Math.PI * 2, true); break;
case 'NOT':
ctx.moveTo(x, y + 10); ctx.lineTo(x + 20, y); ctx.lineTo(x + 20, y + 20); ctx.closePath(); break;
case 'XOR':
ctx.moveTo(x + 5, y); ctx.lineTo(x + 15, y); ctx.lineTo(x + 20, y + 10); ctx.lineTo(x + 15, y + 20); ctx.lineTo(x + 5, y + 20); ctx.lineTo(x, y + 10); ctx.closePath(); break;
}
ctx.fill();
ctx.stroke();
}
function drawComplexLogicUnit(x, y, width, height, name) {
ctx.fillStyle = 'rgba(0, 255, 0, 0.1)';
ctx.strokeStyle = '#0f0';
ctx.fillRect(x, y, width, height);
ctx.strokeRect(x, y, width, height);
// Display name
ctx.fillStyle = '#0f0';
ctx.fillText(name, x + 5, y + 15);
// Randomly place logic gates
const gateTypes = ['AND', 'OR', 'NOT', 'XOR'];
for (let i = 0; i < 5; i++) {
const gateType = gateTypes[Math.floor(Math.random() * gateTypes.length)];
drawLogicGate(gateType, x + Math.random() * (width - 20), y + Math.random() * (height - 20));
}
}
function isOverlapping(x, y, width, height, units) {
return units.some(unit => {
return !(x + width < unit.x || x > unit.x + unit.width || y + height < unit.y || y > unit.y + unit.height);
});
}
function drawConnections(units) {
// Create interesting patterns for lines connecting the units
ctx.strokeStyle = '#0f0';
ctx.lineWidth = 2;
ctx.beginPath();
// Draw lines in a more dynamic and patterned way
for (let i = 0; i < units.length; i++) {
if (i % 2 === 0 && units[i + 1]) { // Example pattern: connect every other block
const startUnit = units[i];
const endUnit = units[i + 1];
ctx.moveTo(startUnit.x + startUnit.width / 2, startUnit.y + startUnit.height / 2);
ctx.lineTo(endUnit.x + endUnit.width / 2, endUnit.y + endUnit.height / 2);
}
}
// Optionally, add more patterns here
ctx.stroke();
}
// Call the modified function
function generateRandomLogicCircuit() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
drawMessage(); // Draw the message first
const units = [];
const attemptsLimit = 50;
for (let i = 0; i < 10; i++) {
let name, x, y, width, height;
let attempts = 0;
do {
name = getRandomName();
width = 100 + Math.random() * 50;
height = 50 + Math.random() * 50;
x = Math.random() * (canvas.width - width);
y = Math.random() * (canvas.height - height - messageHeight) + messageHeight; // Ensure it's below the text area
attempts++;
} while (attempts < attemptsLimit && isOverlapping(x, y, width, height, units));
if (attempts < attemptsLimit) {
units.push({x, y, width, height, name});
drawComplexLogicUnit(x, y, width, height, name);
}
}
drawConnections(units);
}
generateRandomLogicCircuit();
setInterval(generateRandomLogicCircuit, 5000); // Regenerate every 5 seconds
</script>
</body>
</html>