← Home ← Back to /g/

Thread 106371203

15 posts 6 images /g/
Anonymous No.106371203 >>106372730 >>106374282
MAID 4096th
Previous bread: >>106275813

Last week, I decided to make a 2048 clone in Forth because why not. Asked if it was /gedg/ or /dpt/ and was advised to create my own MAID themed thread. I still have no idea what this has to do with maids. Apparently it sparked some maid threads over the week, but I'm still not sure there are enough maidposters to keep it alive 247. Maybe something like "Mondaily Maid Thread" or something similar could work out better? Idk.

Anyway, I fixed fall ( sentinel a1 b1 c1 d1 -- sentinel a2 b2 c2 d2 ) by adding sentinel values and following the algorithm described at >>106277717 . It does work, I don't know why I got confused in the end and stopped. I was very sleepy, I guess. Had to add a lot more words to manipulate the sentinel, and could probably refactor it into something more readable, but I already struggled to make it work, I'll make it nice later. I also don't know why I went nuts over falling>. I could
I also went down the rand() rabbit hole because Forth didn't have it natively. Turns out it's a very simple func. There's also something wrong with the addRandomVal ( -- ), because it was leaving something on the stack. Instead of going over it to fix, I just added a drop and now the game is "playable". There are no checks for victory or loss, it just divides by zero when you fill the board (on random % emptySpaces), but you can have some fun. The major problem right now is that it's really hard to tell the numbers apart at a glance, so I'll change drawGrid to add color escape sequences and such. It'll be hardcoded, maybe later I could integrate it with curses from C libraries for portability, but I don't care right now. Then I'll need to fix the addRandomVal (sometimes it also just don't add anything (or overwrites a 2, idk).
Anonymous No.106371209
sex with Eli.
Anonymous No.106371211 >>106371409
Current source: https://pastebin.com/0cPezjyd
Anonymous No.106371240 >>106371246 >>106371307 >>106371409 >>106373781
I wish your caretaker would lock you away tranny schizo
Anonymous No.106371246
>>106371240
kill yourself.
Anonymous No.106371307 >>106371319 >>106371409
>>106371240
I'm not a tranny nor a schizo. I'm literally just like making game and was specifically told by /gedg/ or /dpt/ (forgot which) to make my own thread and have it MAID themed. I'd gladly just ask my questions or blogpost on either thread (and it would have been on topic: making a game and "what are you working on?"), but was told to make a new thread.
Anonymous No.106371319
>>106371307
*I'd gladly just ask my qeustion with no maid posting
Anonymous No.106371409 >>106371521 >>106371521
>>106371211
>a maid posted her project
>mfw
Which version of Forth are you using?

>>106371240
>I came in a maid thread and now I am mad because there are maidposts in it

>>106371307
Your thread is nice, there are just some lost shartyposters who experience extreme cuteness aggression when they see your maid and extreme jealousy when they see your thread and code.
Anonymous No.106371521
>>106371409
>Which version of Forth are you using?
Gforth, but I wouldn't mind "porting" it to another forth later on. My goal right now is to learn, but later I'd like to compile a binary optimized for size. I have no idea is gforth is the right option for that.

>>106371409
>extreme jealousy when they see your progressposting and code.
Nodev crabbing knows no boudaries, huh?
Anonymous No.106372730 >>106373779
>>106371203 (OP)
>I'm still not sure there are enough maidposters to keep it alive 247
Badump.
Anonymous No.106373779
>>106372730
Maids were really active in /dpt/ earlier, but then they all got banned and their posts got deleted. They also appear to be planning an exodus to Matrix.
t. pogeet !!b2oSUmilA2N No.106373781 >>106374282
>>106371240
OP isn't an actually maid poster.
He was told on /dpt/ that he'll get more help by maid posting and it really did help with gaining the traction on his 4th journey.
Anonymous No.106374282 >>106374393
>>106373781
Thanks, anon. If this thread dies and there's not much maidposting over the week, next weekend I might just post on /dpt/ od /gedg/. I don't want to start a racial holy war.

>>106371203 (OP)
On to my problem, it was a fucking off by one error. My loop was 15 0 do, which means it never fucking went to i=15. Why does (i = 0; i < 16; i++) looks so obvious but 15 0 do ... loop doesn't to my fucked up brain?
Anonymous No.106374393
>>106374282
Forgot to post the fix:

: addRandomVal ( -- )
countEmpty ( n )
rand ( rn )
." A" .s cr
16 0 do
." B" .s cr
grid ( rn grid )
i cells + @ ( rn gridi )
0= ( rn gridi=0? )
." C" .s cr
if ( rn )
." D" .s cr
1- ( rn-- )
dup
0< ( rn rn<0 ) \ gridi==0 and rn<0 Here it is
." E" .s cr
if ( rn )
." F" .s cr
grid i ( rn grid i )
." G" .s cr
cells + ( rn gridi )
2 swap ! ( rn )
leave
then
then
loop
drop
;


Again, it's playable and you can have some fun if you're willing to try to parse the hard to read numbers. It doesn't check victory conditions yet, not losing conditions. And it doesn't check whether you made a valid move to spawn a new 2: you can't fall down and press down, a new tile is spawned anyway, unlike on real 2048. And it only spawns 2 because hardcoded.
Anonymous No.106375739
Bump for no reason.

Next I'll rewrite drawGrid to loop and include colors (hardcoded escapes \e[31m etc), maybe center align.

Then with it looping, I can remove the hard coded 4s and 16s and have it loop over SIZE and SIZE 2* which should allow for custom sizes, first changed via code, then some option menu or command line parsing? Idk.