-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toypad is being detected by the game | Merge pull request #1 from Seg…
…erEnd/dev The toypad is being detected by the game! 🎉, Now need to figure out how to send a minifigure
- Loading branch information
Showing
18 changed files
with
1,822 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
dist/* | ||
.vscode | ||
.clang-format | ||
.editorconfig | ||
.clangd | ||
.editorconfig | ||
.env | ||
.ufbt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "burtle.h" | ||
|
||
// Helper function for rotation | ||
static uint32_t rot(uint32_t a, int b) { | ||
return (a << b) | (a >> (32 - b)); | ||
} | ||
|
||
// Constructor equivalent | ||
void burtle_init(Burtle* b, uint32_t seed) { | ||
b->a = 0xf1ea5eed; | ||
b->b = b->c = b->d = seed; | ||
for(int i = 0; i < 42; ++i) { | ||
burtle_rand(b); // Initialize with 42 iterations | ||
} | ||
} | ||
|
||
// rand method | ||
uint32_t burtle_rand(Burtle* b) { | ||
uint32_t e = b->a - rot(b->b, 21); | ||
b->a = b->b ^ rot(b->c, 19); | ||
b->b = b->c + rot(b->d, 6); | ||
b->c = b->d + e; | ||
b->d = e + b->a; | ||
return b->d; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct { | ||
uint32_t a, b, c, d; | ||
} Burtle; | ||
|
||
void burtle_init(Burtle* b, uint32_t seed); | ||
uint32_t burtle_rand(Burtle* b); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
Oops, something went wrong.