Battle an AI, or watch it play alone. (You can also play solo on this). Play with an enormous variety of customizations to create the best Tetris game-play ever! LAG WARNING: Low processing PCs cannot handle. Preset Controls: - WASD (Hard-drop, left, soft-drop, right), - J+N (right rotation, left rotation), - [space] (hold). TO CHANGE CONTROLS - Click on the box to change a key (do not click on the variable) - Change CPU PPS if you want it to go slower/faster. (will make it easier or harder.) --> Click the arrow above DAS to cycle through these 3 options: - DAS (time before left/right shift repeats) - ARR (How fast the piece moves toward the wall) (0 = instant, 3 = slow) - Soft Drop Speed (How fast the piece moves down while soft dropping) (0 = instant, 5 = slow) <-- --> Click the arrow on the top left of the screen to cycle through the game effects and players, and the CPU Multiplier sandbox. Game Effects and Players: - Click on one of the left three boxes to cycle through them. - The song is set to random upon restarting, and the Player vs CPU is enabled automatically upon restarting. CPU Multiplier Sandbox Explanation: Increasing the value of something makes the CPU prioritize that function. Decreasing makes it prioritize it less. - Bumpiness: Uneven and Bumpy boards are awfully annoying to play on, so the CPU tries to keep the board at a stable height with this rule. It doesn't care about smoothness as much as height reduction with this rule, however. - Dangerous Bumpiness: Bumpy boards are difficult to place pieces on without making a hole, so the CPU tries to keep it as SMOOTH as possible with this rule. Counters the defect of the original bumpiness rule, but lacks height and evenness control. - Holes: The CPU defines a hole as an empty space with any number of filled blocks above it (because the CPU can only hard drop pieces, it can't shift pieces into the side). This rule prevents the CPU from making any holes. - Holes Cover: This rule is only active while there is a hole. If a hole has more than four blocks stacked above it, then it punishes the CPU. This prevents it from blocking a hole forever and eases downstacking. - Non-Quad Punishment: If the CPU doesn't clear 4 lines at once, punish it. (Prevents losing Back-to-Back combo.) CPU instantly does quad upon finding it. <-- I've managed to get the CPU up to about 5.25 pps. Quite easy to beat if you can hit it really hard, even at really fast speeds. (Though that;s the opinion of someone who plays at about 170 VS average.)
Thanks to zsiegel for a simple number sorter for my Genetic Algorithm https://scratch.mit.edu/projects/20032549/ If you find a CPU customization that plays better than it currently does, please share it in the comments! It would help a lot. The hold function doesn't exactly seem to function like it should. The CPU IS smarter, but it holds the I piece for too long. It's not even told to do that! Thanks to Tetr.io for the damage table (incomplete, but most won't notice/care) (I will continue improving it) Thanks to PullJosh for showing me how to make Tetris on scratch. I made this one all on my own, but he showed me the basics. (My rotation system is better because it works :P) And thanks to me for my dedication to things like this. Future Updates (in no particular order): - CPU openers - Finishing the Damage Table - On-screen Text data (T-Spin, ALL-CLEAR, better PPS text, combo, B-T-B combo, APM) - Damage bar and danger sound - Improved CPU processing (decrease lag, but decrease max speed) - CPU processing based on speed -Give me some ideas! Recent Updates (Most recent to least): - Added size effect to damage when sent. - Fixed glitch that caused CPU to kill itself when it could have been okay. - Fixed glitch where CPU blocked all damage with 1 attack - Made CPU piece movement instantaneous for maximum speed buff - Added population size choice to Algorithm function - Added Genetic Algorithm Function that allows the CPU to evolve from scratch. - Added VS score for Player and CPU. I will be using this with a genetic algorithm to make it smarter. - Added pillars rule; prevents the CPU from making multiple large holes, and rewards it for having one. Increases likeliness of quad combos. - Added CPU solo damage. Press the number keys to send damage to the CPU while in solo. - Added First to # addition. Fight on! Also comes with custom points feature. - Added total sent damage visual effects for both the player and CPU. - Updated default CPU customizations. - Added a perfect clear guide. If the CPU can perfect clear with it's current or held piece it will. - Added death prevention. CPU won't willingly kill itself as easily. (Doesn't consider incoming garbage) - Added Randomize button for CPU customizations. - Added Non-Quad punishment CPU customization. - Added the multiplier sandbox section with a [Set to Defaults] button. - Added a holes rule: cannot stack more than 4 blocks above a hole without punishment. Helps the CPU break down holes more easily. - Added a new type of bumpiness detection. Very simple to implement, significantly increases intelligence. - Replaced usage of actual rotation in move testing - Quads instantly decide move for CPU (Much more efficient) - CPU can hold (but doesn't do it right). - CPU is more visually pleasing (you don't see it testing rotations). - Fixed player having extra air time. - CPU and Player has sound. - Corrected a t-spin maneuver (if you do that last kick in the table, it's a FULL t-spin). - Corrected All-Clear Damage (Is now completely separate from any other damage). - Board doesn't disappear upon death. - Board is centered when in solo play. - Improved CPU's ability to play when stacked up high. - Added more enabling and disabling features; you can play alone, the CPU can play alone, or you can both play. - Added Soft Drop speed customization. - Add the ARR and DAS customizations with arrow for ease of access. - Decreased processing used in one frame; cut into parts - Added CPU PPS customization - Added Disabling CPU feature for solo testing - Made the game! (Customizable controls, music, skins, bumpiness and holes detection for CPU, player vs CPU board drawing, etc.) How it works: I made it run just two different checks; does it make holes (weighted very heavily because it can't soft drop and that would be A LOT of work) and bumpiness (weighted a little). It also runs height checks to determine if it should focus on down-stacking or getting quads, but it won't be effective until I add holding for the CPU. It limits the amount of work it does in one frame by testing up to only ten positions in one frame (i piece only tests this many in one frame, the rest test up to 8) and by testing each rotation one frame at a time. It also cancels doing the other rotations if they're the exact same as other rotations (s, z, o, and i pieces) This allows the CPU to go faster as it does less, unnecessary, checks. After collecting data, it gives a score on each position, and whatever score is the BEST is the one that it enacts.