Format code

This commit is contained in:
Joop Schilder 2020-11-14 11:17:31 +01:00
parent cde99a0d0a
commit 18d7cce366
1 changed files with 3 additions and 5 deletions

View File

@ -8,9 +8,7 @@
Not that it matters, as it's randomly chosen, but done anyway for the sake of repeatability.
Joop Schilder
Sat 14 Nov 01:30
One of the nights that I shall remember as if it were me who was in control of my brain.
Fri 13 Nov
*/
const NUM_NODES = 20;
@ -25,7 +23,7 @@ const TRUTH_TABLE_SIZE = (1 << NUM_CONNECTIONS);
$truth_table = [];
for ($i = 0; $i < TRUTH_TABLE_SIZE; $i++) {
$truth_table[$i] = random_int(0, 100) % 2;
$truth_table[$i] = random_int(0, 100) % 2;
}
$nodes = [];
@ -72,7 +70,7 @@ function propagate(array $nodes, array &$connections, array &$truth_table): arra
for ($i = 0; $i < NUM_NODES; $i++) {
$tt_index = 0;
for ($j = 0; $j < NUM_CONNECTIONS; $j++) {
$tt_index += $nodes[$connections[$i][$j]] << (NUM_CONNECTIONS - 1 - $j);
$tt_index += $nodes[$connections[$i][$j]] << (NUM_CONNECTIONS - 1 - $j);
}
$next_nodes[$i] = $truth_table[$tt_index];
}