Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The following C++ code emulates Tile World's RNG to discover a starting seed and time that will result in a perfect score for CCLP1 level 82, Launch.
- //This assumes a specific series of inputs calibrated to be as likely as possible, with odds of approximately 1/14800.
- #include <iostream>
- #include <math.h>
- #include <stdlib.h>
- #include <cstring>
- using namespace std;
- void VerifyInput();
- int LOOPS = 1000000;
- int startseed = 0;
- int seed = 0;
- int seeds[1000000];
- int index = 0;
- int count = 0;
- string RFFS = "";
- string dirs = "";
- int bits = 0;
- char RFF = ' ';
- bool match = false;
- string checker = "";
- string checkchar = "";
- int i = 0;
- int Rcount = 0;
- int point = 0;
- int verified = 0;
- int main(){
- //set seed
- seed = 3;
- while(count < LOOPS){
- //push RNG
- seed = (seed * 1103515245 + 12345) & 0x7FFFFFFF;
- //store new RNG seed in array
- seeds[count] = seed;
- //convert new seed to RFF
- //remove the last 29 bits
- //0 = U, 1 = L, 2 = D, 3 = R
- bits = seed >> 29;
- if(bits == 0)
- RFF = 'U';
- if(bits == 1)
- RFF = 'L';
- if(bits == 2)
- RFF = 'D';
- if(bits == 3)
- RFF = 'R';
- //add RFF to string
- RFFS.append(1, RFF);
- count++;
- }
- count = 5;
- while(count < (LOOPS - 25)){
- //check the substring of length 4 starting at index for one of:
- //"LUUD", "LUUR", "ULLU", "URLU", "UDLU"
- dirs = RFFS.substr(count, 4);
- //if match, print seeds[index] and the substring of length 20
- if(dirs == "LUUD" || dirs == "LUUR" || dirs == "ULLU" || dirs == "URLU" || dirs == "UDLU"){
- VerifyInput();
- }
- count++;
- }
- cout<<verified;
- system("pause");
- return 0;
- }
- void VerifyInput(){
- i = 0;
- Rcount = 0;
- match = true;
- checker = dirs.substr(0, 1);
- if(checker == "L"){
- point = 3;
- }
- if(checker == "U"){
- point = 4;
- }
- checker = RFFS.substr(count+point, 9);
- if(checker.substr(0,1) == "U" || checker.substr(0,1) == "L"){
- match = false;
- }
- if(checker.substr(7,2) != "DD"){
- match = false;
- }
- //check for exactly 2 "R"
- while(i < 9){
- checkchar = checker.substr(i,1);
- if(checkchar == "R"){
- Rcount++;
- }
- i++;
- }
- if(Rcount != 2){
- match = false;
- }
- //check for no adjacent "U, L" pairs in (1, 6)
- i=1;
- while(i < 6){
- checkchar = checker.substr(i,2);
- if(checkchar == "LL" || checkchar == "LU" || checkchar == "UL" || checkchar == "UU"){
- match = false;
- }
- i++;
- }
- if(match == true){
- cout << RFFS.substr(count, 20) << " " << seeds[count-1] << " " << seeds[count-5] << endl;
- }
- verified++;
- }
Add Comment
Please, Sign In to add comment