Skilled player (1742)
Joined: 9/17/2009
Posts: 4984
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
zaphod77 wrote:
Well, need to a) reverse random generator and determine the number of possible seeds. b) test out all possible seeds to get their llayouts. c) eliminate all the aproduce an odd number of blocks d) eliminate all that produce a multiple of four blocks e) test all remaining initial states. i believ eit' sbetter in most cases to drop one extra piece than make one extra line clear.
Or just code a program that brute-forces until the solution is found. (Like what Acmlm did for his run).
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
zaphod77 wrote:
a) reverse random generator and determine the number of possible seeds.
there are two RNGs ($0017 and $0018) so the maximum number of possible seeds is 256²=65536
Baxter wrote:
The number of garbage blocks is random, if I remember correctly, it will vary between like 50 and 55.
i tested some cases and it went between 46 and 62
Baxter wrote:
My TAS has a total of 9 line clear animations.
i actually count 10 line-clear animations...
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Expert player (2573)
Joined: 12/23/2007
Posts: 831
Masterjun wrote:
Baxter wrote:
The number of garbage blocks is random, if I remember correctly, it will vary between like 50 and 55.
i tested some cases and it went between 46 and 62
Baxter wrote:
My TAS has a total of 9 line clear animations.
i actually count 10 line-clear animations...
I agree. Me too.
Recent projects: SMB warpless TAS (2018), SMB warpless walkathon (2019), SMB something never done before (2019), Extra Mario Bros. (best ending) (2020).
Skilled player (1410)
Joined: 5/31/2004
Posts: 1821
Must have miscounted. What influences these RNGs? Are they just timers? If you have to wait 65536 frames to get to the 65536th initial garbage state, then there is no use for the vaste majority of initial states for such a short TAS. Every frame that is spent manipulating must be gained again due to the better randomness.
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
Baxter wrote:
What influences these RNGs? Are they just timers? If you have to wait 65536 frames to get to the 65536th initial garbage state, then there is no use for the vaste majority of initial states for such a short TAS. Every frame that is spent manipulating must be gained again due to the better randomness.
the normal RNG routine, where X:17 and Y:02 :
00:AB47:B5 00     LDA $00,X
00:AB49:29 02     AND #$02
00:AB4B:85 00     STA $0000
00:AB4D:B5 01     LDA $01,X
00:AB4F:29 02     AND #$02
00:AB51:45 00     EOR $0000
00:AB53:18        CLC
00:AB54:F0 01     BEQ $AB57
00:AB56:38        SEC
00:AB57:76 00     ROR $00,X
00:AB59:E8        INX
00:AB5A:88        DEY
00:AB5B:D0 FA     BNE $AB57
00:AB5D:60        RTS
so this shifts both $0017 and $0018 right and uses bit 0(of $0017) as bit 7 in $0018 like:
11111001 00001100 ($0017, $0018; #$F9, #$0C)
next frame will be
01111100 10000110 (#$7C, #$86)
but there is another thing in the routine, if bit 1 of $0017 and $0018 are different, then the bit 7 of $0017 will be set so in the example:
01111100 10000110 (#$7C, #$86)
next frame will be
10111110 01000011 (#$BE, #$43)
but sometimes the RNGs will be called 2 times in one frame, so its not that easy... EDIT: so i wrote a program and I can say that there are exactly 32767 possible different seeds. they have a fixed order, so, for example, you have to wait a long time to get the last seed (which is #$13, #$11)
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Player (138)
Joined: 9/18/2007
Posts: 389
Well, now I also think that the current run is improvable. 25 lines to clear. 12 lines filled with garbage. 7 line clear animations required. We need to manipulate a "good" garbage pattern. We require garbageblocks mod 4 == 2, and as much garbageblocks as possible. manipulating 4 additional blocks should take no more than 30 to 60 frames, manipulating 8 blocks shouldn't take more than 60 to 120 frames (exact numbers need to be tested). Also, as much garbage as possible should be at the bottom (less pieces need to be dropped down deep.) The current solution requires 10 line clear animations, which takes a known amount of frames (something around 30 frames, you know it better than me). Lets assume that we know the solution for every seed with the lowest amount of line clears. So we need to check at worst all earlier seeds and the next 30*(10-7)*2 = 180 seeds if they allow solutions with less than 10 line clears. (Well, if the current seed allows a solution with less than 10 line clears, it will almost definitely be improvable.) I would guess that only one out of four of the solutions satisfies garbageblocks mod 4 == 2, so that would only be ~45 seeds to check. On average, we need to clear 2 lines of garbage, and 2 extra lines. If we can manipulate a garbage pattern which allows 3 or even 4 garbage lines to be cleared at once, that would be nice. This would increase chances for a solution with 7 line clears. Clearing more than 2 lines of garbage at once is most likely impossible. We can afford to clear only 3 lines exactly 3 times. We can also afford to combine 1 line of garbage with 2 or 3 extra lines. If we have can choose where we do the extra lines, then they should be done as early as possible. Well, and one thing which makes all of this more complicated If the blocks don't need to be dropped that deep, we require less time until the next block starts. It might be well worth the time to do the extra lines very early and do an extra line clear later on. Doing line clears at the top requires less time than doing them at the bottom. If N is the number of frames it takes to get a block down one line, we may save ~2,5*N frames for clearing a line one position more at the top. Let's build a formula for exactly calculating the time. One more idea At the end, manipulate garbage and build the bottom in a way which allows input to be ended before the last pieces are dropped.
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
partyboy1a wrote:
We need to manipulate a "good" garbage pattern.
No, seriously, if you really want to get just 7 line clear animations you have to "manipulate"(or wait for) a PERFECT pattern. You can be really happy if it is possible to solve the seed in 9 line animations. I tested a seed until I realized that I could only single the last 6 rows and that happens really often, because its... well... garbage!
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Player (56)
Joined: 10/16/2012
Posts: 233
Location: Milwaukee, WI
Can I make one that plays past level 29? I heard it gets all glitched up after 29!
If I could have a tool-assisted real life, I'd... Being a novice, I'd probably load the wrong state, have the IRS AI bankrupt me, and eventually make me want to kill myself and redo 11 years of hard work.
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
That wouldn't be entertaining at all because it would take very long to go where it is glitched. Also, what would be the goal? "fastest glitched graphics"? I think that wouldn't make any sense at all...
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Player (36)
Joined: 9/11/2004
Posts: 2630
JWinslow23 wrote:
Can I make one that plays past level 29? I heard it gets all glitched up after 29!
If you feel like spending several hours watching Tetris videos, here's an exploration of the levels past 29. https://www.youtube.com/playlist?list=PLA319A7DABA7CA0D4&feature=plcp Spoilers, it ends here: https://www.youtube.com/watch?v=Ci_8lERpGc0&feature=relmfu
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Player (56)
Joined: 10/16/2012
Posts: 233
Location: Milwaukee, WI
I saw the videos linked to by OmnipotentEntity, and it starts to get glitched as soon as you reach level 30! If you look closely, you will notice that it shows up as 00, and it goes on from there.
If I could have a tool-assisted real life, I'd... Being a novice, I'd probably load the wrong state, have the IRS AI bankrupt me, and eventually make me want to kill myself and redo 11 years of hard work.
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
still my question
Masterjun wrote:
Also, what would be the goal?
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Player (56)
Joined: 10/16/2012
Posts: 233
Location: Milwaukee, WI
Masterjun, my goal would have to be "fastest level 100", or something similar.
If I could have a tool-assisted real life, I'd... Being a novice, I'd probably load the wrong state, have the IRS AI bankrupt me, and eventually make me want to kill myself and redo 11 years of hard work.
YoungJ1997lol
He/Him
Player (9)
Joined: 7/4/2011
Posts: 550
Location: U.S.A.
JWinslow23 wrote:
Masterjun, my goal would have to be "fastest level 100", or something similar.
Wow, 3rdgame you've been talking about TASing. I'm suprised.
So yea, how's it going? Currently TASing: Nothing
Noxxa
They/Them
Moderator, Expert player (4126)
Joined: 8/14/2009
Posts: 4090
Location: The Netherlands
JWinslow23 wrote:
Masterjun, my goal would have to be "fastest level 100", or something similar.
A better category would be "fastest level overflow", to the point where the game returns to level 00. That's less arbitrary than "level 100". That said, such a category wouldn't be publishable material anyway, because the run would be quite long, several times longer than "fastest 999999", and it wouldn't add that much to the existing published material. It would, however, still be quite an interesting run, if you do decide to make it.
http://www.youtube.com/Noxxa <dwangoAC> This is a TAS (...). Not suitable for all audiences. May cause undesirable side-effects. May contain emulator abuse. Emulator may be abusive. This product contains glitches known to the state of California to cause egg defects. <Masterjun> I'm just a guy arranging bits in a sequence which could potentially amuse other people looking at these bits <adelikat> In Oregon Trail, I sacrificed my own family to save time. In Star trek, I killed helpless comrades in escape pods to save time. Here, I kill my allies to save time. I think I need help.
Skilled player (1742)
Joined: 9/17/2009
Posts: 4984
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
JWinslow23 wrote:
I saw the videos linked to by OmnipotentEntity, and it starts to get glitched as soon as you reach level 30! If you look closely, you will notice that it shows up as 00, and it goes on from there.
That's not the true level "0", since the speed remains high. The last video in the playlist shows it goes up to 329 to actually loop back to "0". Good luck TASing 329 levels of tetris.
Player (56)
Joined: 10/16/2012
Posts: 233
Location: Milwaukee, WI
Mothrayas wrote:
A better category would be "fastest level overflow", to the point where the game returns to level 00. That's less arbitrary than "level 100". That said, such a category wouldn't be publishable material anyway, because the run...wouldn't add that much to the existing published material. It would, however, still be quite an interesting run, if you do decide to make it.
I agree. However, can I work on it, even if it doesn't get published?
If I could have a tool-assisted real life, I'd... Being a novice, I'd probably load the wrong state, have the IRS AI bankrupt me, and eventually make me want to kill myself and redo 11 years of hard work.
Masterjun
He/Him
Site Developer, Skilled player (1988)
Joined: 10/12/2010
Posts: 1185
Location: Germany
JWinslow23 wrote:
However, can I work on it, even if it doesn't get published?
you can do whatever you want as long as you don't submit it
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Editor, Skilled player (1536)
Joined: 7/9/2010
Posts: 1319
Favorite animal: STOCK Gt(ROSA)26Sortm1.1(rtTA,EGFP)Nagy Grm7Tg(SMN2)89Ahmb Smn1tm1Msd Tg(SMN2*delta7)4299Ahmb Tg(tetO-SMN2,-luc)#aAhmb/J YouTube Twitch
Joined: 6/9/2014
Posts: 3
I am new to TAS and I have decided to attempt to beat the mode B 19-5 run. My first attempt I did blind without looking anything up. It resulted in 2775 frames or 46.25 seconds as compared to the record at 2331 frames or 38.85 seconds. Considering it was my first TAS I don't think it was too bad. I realized upon review that I wasted a lot of time with single line clears. Then I decided to do a little research when I stumbled upon this thread. I have read the discussion of testing seeds to find a good garbage pattern. Although I am new to TAS, I have a little of experience with assembly. So I have been poking through the disassembled code in the hopes of creating a program to find the best seeds. I will post more as I figure out more but for now I believe I have located the code that generates the garbage patterns if anyone is interested to try for themselves.
00:87E3:A9 0C     LDA #$0C      ;initialize values
00:87E5:85 A8     STA $00A8     
00:87E7:A5 A8     LDA $00A8     ;loops here for next row
00:87E9:F0 5F     BEQ $884A     
00:87EB:A9 14     LDA #$14      
00:87ED:38        SEC           
00:87EE:E5 A8     SBC $00A8     
00:87F0:85 A9     STA $00A9     
00:87F2:A9 00     LDA #$00      
00:87F4:85 69     STA $0069     
00:87F6:85 89     STA $0089     
00:87F8:A9 09     LDA #$09      
00:87FA:85 AA     STA $00AA     
00:87FC:A2 17     LDX #$17      ;loop here for next column
00:87FE:A0 02     LDY #$02      
00:8800:20 47 AB  JSR $AB47     ;generate next random value
00:8803:A5 17     LDA $0017     
00:8805:29 07     AND #$07      
00:8807:A8        TAY           
00:8808:B9 7C 88  LDA $887C,Y   ;get a random tile
00:880B:85 AB     STA $00AB     
00:880D:A6 A9     LDX $00A9     
00:880F:BD D6 96  LDA $96D6,X   ;get row offset
00:8812:18        CLC           
00:8813:65 AA     ADC $00AA     
00:8815:A8        TAY           
00:8816:A5 AB     LDA $00AB     
00:8818:99 00 04  STA $0400,Y   ;store tile in memory
00:881B:A5 AA     LDA $00AA     
00:881D:F0 05     BEQ $8824     
00:881F:C6 AA     DEC $00AA     
00:8821:4C FC 87  JMP $87FC     ;loop until row is finished
00:8824:A2 17     LDX #$17      
00:8826:A0 02     LDY #$02      
00:8828:20 47 AB  JSR $AB47     ;generate next random value
00:882B:A5 17     LDA $0017     
00:882D:29 0F     AND #$0F      
00:882F:C9 0A     CMP #$0A      
00:8831:10 F1     BPL $8824     ;loop until (rand & #$0F) < #$0A
00:8833:85 AC     STA $00AC     
00:8835:A6 A9     LDX $00A9     
00:8837:BD D6 96  LDA $96D6,X   
00:883A:18        CLC           
00:883B:65 AC     ADC $00AC     
00:883D:A8        TAY           
00:883E:A9 EF     LDA #$EF      
00:8840:99 00 04  STA $0400,Y   ;set random block in row to an empty tile
00:8843:20 2F AA  JSR $AA2F     
00:8846:C6 A8     DEC $00A8     
00:8848:D0 9D     BNE $87E7     ;loop until all rows are done
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11480
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
You can give names to addresses too, by rightclicking. http://www.fceux.com/web/help/fceux.html?Debugger.html
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 6/9/2014
Posts: 3
I have finished my program and I found out a few things in the process. It turns out that there is a bug in the original tetris code where it is impossible for there to be a garbage tile in the upper left corner in mode B. It is not possible to use every seed after the first available one. This is because the code does not call its random function evenly. To solve this I ran a lua script that found all possible seeds waiting a maximum of 100 frames. I then took these seeds and put them in a java program to generate the garbage pattern. I took all the seeds where (tiles % 4 == 2) and analyzed them for how many line clears it would take to clear the garbage pattern. My algorithm is not perfect (I didn't spend much time on it) and will not generate totally accurate numbers, but they usually are correct. Here are my results:
Seed=8e2d	wait frames=0 	# of tiles=46	clear anim=11
Seed=21eb	wait frames=10	# of tiles=58	clear anim=11
Seed=9948	wait frames=12	# of tiles=54	clear anim=10
Seed=2652	wait frames=13	# of tiles=54	clear anim=10
Seed=a265	wait frames=14	# of tiles=54	clear anim=11
Seed=3a26	wait frames=15	# of tiles=54	clear anim=10
Seed=c744	wait frames=16	# of tiles=50	clear anim=10
Seed=1a0e	wait frames=19	# of tiles=54	clear anim=11
Seed=4341	wait frames=20	# of tiles=54	clear anim=10
Seed=2028	wait frames=23	# of tiles=50	clear anim=10
Seed=840	 wait frames=25	# of tiles=54	clear anim=10
Seed=9021	wait frames=27	# of tiles=54	clear anim=10
Seed=1e64	wait frames=34	# of tiles=50	clear anim=10
Seed=8f32	wait frames=35	# of tiles=54	clear anim=10
Seed=4b4f	wait frames=42	# of tiles=54	clear anim=10
Seed=bdc4	wait frames=53	# of tiles=50	clear anim=9
Seed=2f71	wait frames=54	# of tiles=50	clear anim=9
Seed=e00b	wait frames=57	# of tiles=58	clear anim=11
Seed=bd78	wait frames=60	# of tiles=62	clear anim=12
Seed=fe2b	wait frames=62	# of tiles=54	clear anim=10
Seed=6773	wait frames=74	# of tiles=62	clear anim=12
Seed=14ce	wait frames=75	# of tiles=50	clear anim=12
Seed=d14c	wait frames=76	# of tiles=50	clear anim=12
Seed=e768	wait frames=79	# of tiles=58	clear anim=12
Seed=8c37	wait frames=86	# of tiles=50	clear anim=11
Seed=a376	wait frames=90	# of tiles=50	clear anim=11
Seed=d546	wait frames=91	# of tiles=54	clear anim=12
Seed=724e	wait frames=94	# of tiles=54	clear anim=11
Seed=ce49	wait frames=95	# of tiles=54	clear anim=12
Seed=79c9	wait frames=96	# of tiles=50	clear anim=11
Seed=c3ce	wait frames=97	# of tiles=54	clear anim=11
Note that the 2652 seed was that seed that baxter used for his TAS.
Seed=8e2d   wait frames=0    # of tiles=46   clear anim=11    benefits=Has zero wait frames
Seed=21eb   wait frames=10   # of tiles=58   clear anim=11    benefits=Starts with 58 garbage tiles
Seed=9948   wait frames=12   # of tiles=54   clear anim=10    benefits=Has 10 line animations and low wait frames
Seed=2652   wait frames=13   # of tiles=54   clear anim=10    benefits=Has 10 line animations and low wait frames
Seed=bdc4   wait frames=53   # of tiles=50   clear anim=9     benefits=Has 9 line animations but more wait frames
Seed=2f71   wait frames=54   # of tiles=50   clear anim=9     benefits=Has 9 line animations but more wait frames
These are probably the fastest six. I have also made the java program display an image of what it would look like. Here are the six seeds above with the lowest wait frames first: EDIT: Here is my java code for generating the garbage pattern. It isn't written the best but it works.
	void generateSeed() {
		for(curRow = 0x0C; curRow!=0; curRow--){
			rowOffsetIndex = (byte) (0x0C - curRow);
			for(curColumn = 0x09; curColumn>=0; curColumn--){
				rand();
				wellMem[10*rowOffsetIndex + curColumn] = (byte) tileArray[rand17 & 0x07];
			}
			do{
				rand();
			}while((rand17 & 0x0F) >= 0x0A);
			wellMem[10*rowOffsetIndex + (rand17 & 0x0F)] = 0;
			rand();
		}
		wellMem[0] = 0;
	}
	
	void rand() {
		rand = ((((rand >> 9) & 1) ^ ((rand >> 1) & 1)) << 15) | (rand >> 1);
		rand17 = (byte) (rand >> 8);
	}
Joined: 6/9/2014
Posts: 3
I've encountered my first major desync. I lost 16 of 19 pieces (and 600 frames). I don't even know how this happened and I could even replicate it.
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11480
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Please put spaces between the pictures so that the site could break the line. Otherwise, great effort!
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
MarbleousDave
He/Him
Player (13)
Joined: 9/12/2009
Posts: 1560
There is a hack called Tetris Zer0 and we could do 2 players. If both players land their pieces at the same time opens up a glitch which replaces player 2's piece dealt out with player 1's next piece.