Thread 105687698 - /g/ [Archived: 784 hours ago]

Anonymous
6/24/2025, 9:18:54 AM No.105687698
IMG_20250624_115156
IMG_20250624_115156
md5: 19d9d97c85ac01de0de3fb9582a5c4b5🔍
im a programmer and im making a tictactoe ai right now using rust. what you suggest to help me improve?
Replies: >>105687713 >>105687727 >>105687776 >>105687869 >>105688410 >>105688468 >>105688752 >>105688799 >>105690985
Anonymous
6/24/2025, 9:22:36 AM No.105687713
1732953415102289
1732953415102289
md5: 640e26601160cdfbc32c2dacf48712f8🔍
>>105687698 (OP)
>what you suggest to help me improve?
Replies: >>105687737
Anonymous
6/24/2025, 9:25:49 AM No.105687727
>>105687698 (OP)
Castration
Replies: >>105687737
Anonymous
6/24/2025, 9:26:51 AM No.105687737
>>105687713
First post seethe post
>>105687727
Second post seethe post

It's too easy
Replies: >>105688377
Anonymous
6/24/2025, 9:33:08 AM No.105687776
1720007868492613
1720007868492613
md5: 19ee03313806f49c487c04cdb89c444a🔍
>>105687698 (OP)
>what you suggest to help me improve?
Anonymous
6/24/2025, 9:53:02 AM No.105687869
>>105687698 (OP)
>core::fmt
>std::fmt
>not deriving clone, copy, debug, etc...
>&'b CellValue
absolute shit code
Replies: >>105688476
Anonymous
6/24/2025, 11:31:03 AM No.105688377
1725632002129974
1725632002129974
md5: f3ecdbe42dc48428050e34e7814d67c7🔍
>>105687737
3rd post, cope post
Anonymous
6/24/2025, 11:37:25 AM No.105688410
>>105687698 (OP)
there is zero need for references and that lifetime
Anonymous
6/24/2025, 11:50:32 AM No.105688468
>>105687698 (OP)
use luajit. its way simpler
Anonymous
6/24/2025, 11:52:14 AM No.105688476
>>105687869
you have no idea what youre talking about
its just tictactoe retard
Anonymous
6/24/2025, 12:41:07 PM No.105688752
>>105687698 (OP)
Why does the board reference cells instead of owning them. A board is defined as a collection of cells.
Why are you givibg every cell a name instead of using [[CellValue; 3]; 3] (or [CellValue; 9], no difference)
Anonymous
6/24/2025, 12:48:47 PM No.105688799
>>105687698 (OP)
Since all your cells are &'b, you should definitely use an array (or better a slice) to store them.
Then you can use whatever rust's equivalent of c++'s mdspan to easily access them in a 2d array maner.

Also, it would make more sense that the tic-tac-toe board owns the cells. I don't know what your initialization logic looks like, but it would greatly help if you delegated the cell's initialization to the board. You'll find out soon enough, when you try to mutate a cell that is already immutably borrowed by the board
Anonymous
6/24/2025, 5:30:55 PM No.105690985
>>105687698 (OP)
a cell has 3 states -> so you need 2 bits to represent a cell the entire board could be represented in 18 bits so you need one u32

then you could create every state for which one player wins for this u32 and just match against them and match to the flipped version for the other player

by this you avoid every loop and every lifetime

if you don't do this why exactly does the board not have ownership of all the CellValues?