JanEric1
MModular
•Created by JanEric1 on 11/10/2024 in #questions
Compile time facilities
I am trying to write a function that compares a SIMD variable against a a sequence of other SIMD vectors that are determined by a function parameter and I want the function to do as much as possible at compile time. Ideally so that at runtime the function just has a structure like
Currently I have it like this
But I am not sure if this does everything I want at compile time and if there are other things I can do to do that?
10 replies
MModular
•Created by JanEric1 on 11/7/2024 in #questions
Most efficient way to check for tictactoe board win
I want to write a litle tictactoe game (with arbitrary board size) in Mojo and was thinking how to go the hardest on optimizing it (just for fun).
I was thinking of using a SIMD to hold the board where 0 is empty, 1 is player X and 2 is player O.
Then i can check for a full board like:
For checking for a win i thought i could just pregenerate the wincombinations at compile time:
for a 2x2 board and then run
against all of these. But i am not sure how i can pregenerate all of these references at compile time.
7 replies