It's time to continue on freyhoe analysis
This commit is contained in:
parent
712a52ad7b
commit
232aa71e75
|
@ -1,25 +1,26 @@
|
||||||
//import 'dart:convert';
|
import 'dart:convert';
|
||||||
//import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
//import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
//import 'tetrio_multiplayer_replay.dart';
|
import 'tetrio_multiplayer_replay.dart';
|
||||||
|
|
||||||
/// That thing allows me to test my new staff i'm trying to implement
|
// That thing allows me to test my new staff i'm trying to implement
|
||||||
//void main() async {
|
void main() async {
|
||||||
// List<Tetromino> queue = List.from(tetrominoes);
|
List<Tetromino> queue = List.from(tetrominoes);
|
||||||
// TetrioRNG rng = TetrioRNG(0);
|
TetrioRNG rng = TetrioRNG(0);
|
||||||
// queue = rng.shuffleList(queue);
|
queue = rng.shuffleList(queue);
|
||||||
// print(queue);
|
print(queue);
|
||||||
// queue = List.from(tetrominoes);
|
queue = List.from(tetrominoes);
|
||||||
// queue = rng.shuffleList(queue);
|
queue = rng.shuffleList(queue);
|
||||||
// print(queue);
|
print(queue);
|
||||||
|
|
||||||
// var downloadPath = await getDownloadsDirectory();
|
var downloadPath = await getDownloadsDirectory();
|
||||||
// ReplayData replay = ReplayData.fromJson(jsonDecode(File("${downloadPath!.path}/65b504a9ade6d287b8427af0").readAsStringSync()));
|
var replayJson = jsonDecode(File("/home/dan63047/Документы/replays/6550eecf2ffc5604e6224fc5.ttrm").readAsStringSync());
|
||||||
// List<List<Tetromino>> board = [for (var i = 0 ; i < 40; i++) [for (var i = 0 ; i < 10; i++) Tetromino.empty]];
|
ReplayData replay = ReplayData.fromJson(replayJson);
|
||||||
|
List<List<Tetromino>> board = [for (var i = 0 ; i < 40; i++) [for (var i = 0 ; i < 10; i++) Tetromino.empty]];
|
||||||
//print(replay.rawJson);
|
//print(replay.rawJson);
|
||||||
|
|
||||||
//print("");
|
print("");
|
||||||
// exit(0);
|
exit(0);
|
||||||
//}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:vector_math/vector_math_64.dart';
|
||||||
|
|
||||||
import 'tetrio.dart';
|
import 'tetrio.dart';
|
||||||
|
|
||||||
// I want to implement those fancy TWC stats
|
// I want to implement those fancy TWC stats
|
||||||
|
@ -269,399 +271,435 @@ class ReplayData{
|
||||||
|
|
||||||
// can't belive i have to implement that difficult shit
|
// can't belive i have to implement that difficult shit
|
||||||
|
|
||||||
// List<Event> readEventList(Map<dynamic, dynamic> json){
|
List<Event> readEventList(Map<dynamic, dynamic> json){
|
||||||
// List<Event> events = [];
|
List<Event> events = [];
|
||||||
// int id = 0;
|
int id = 0;
|
||||||
// for (var event in json['data'][0]['replays'][0]['events']){
|
for (var event in json['data'][0]['replays'][0]['events']){
|
||||||
// int frame = event["frame"];
|
int frame = event["frame"];
|
||||||
// EventType type = EventType.values.byName(event['type']);
|
EventType type = EventType.values.byName(event['type']);
|
||||||
// switch (type) {
|
switch (type) {
|
||||||
// case EventType.start:
|
case EventType.start:
|
||||||
// events.add(Event(id, frame, type));
|
events.add(Event(id, frame, type));
|
||||||
// break;
|
break;
|
||||||
// case EventType.full:
|
case EventType.full:
|
||||||
// events.add(EventFull(id, frame, type, DataFull.fromJson(event["data"])));
|
events.add(EventFull(id, frame, type, DataFull.fromJson(event["data"])));
|
||||||
// break;
|
break;
|
||||||
// case EventType.targets:
|
case EventType.targets:
|
||||||
// // TODO
|
events.add(EventTargets(id, frame, type, Targets.fromJson(event["data"])));
|
||||||
// break;
|
break;
|
||||||
// case EventType.keydown:
|
case EventType.keydown:
|
||||||
// events.add(EventKeyPress(id, frame, type,
|
events.add(EventKeyPress(id, frame, type,
|
||||||
// Keypress(
|
Keypress(
|
||||||
// KeyType.values.byName(event['data']['key']),
|
KeyType.values.byName(event['data']['key']),
|
||||||
// event['data']['subframe'],
|
event['data']['subframe'],
|
||||||
// false)
|
false)
|
||||||
// ));
|
));
|
||||||
// break;
|
break;
|
||||||
// case EventType.keyup:
|
case EventType.keyup:
|
||||||
// events.add(EventKeyPress(id, frame, type,
|
events.add(EventKeyPress(id, frame, type,
|
||||||
// Keypress(
|
Keypress(
|
||||||
// KeyType.values.byName(event['data']['key']),
|
KeyType.values.byName(event['data']['key']),
|
||||||
// event['data']['subframe'],
|
event['data']['subframe'],
|
||||||
// true)
|
true)
|
||||||
// ));
|
));
|
||||||
// break;
|
break;
|
||||||
// case EventType.end:
|
case EventType.end:
|
||||||
// // TODO: Handle this case.
|
event.add(EventEnd(id, frame, type, EndData(event['data']['reason'], DataFull.fromJson(event['data']['export']))));
|
||||||
// case EventType.ige:
|
break;
|
||||||
// // TODO: Handle this case.
|
case EventType.ige:
|
||||||
// case EventType.exit:
|
// TODO: Handle this case.
|
||||||
// // TODO: Handle this case.
|
case EventType.exit:
|
||||||
// }
|
events.add(Event(id, frame, type));
|
||||||
// id++;
|
}
|
||||||
// }
|
id++;
|
||||||
// return [];
|
}
|
||||||
// }
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
// enum EventType
|
enum EventType
|
||||||
// {
|
{
|
||||||
// start,
|
start,
|
||||||
// end,
|
end,
|
||||||
// full,
|
full,
|
||||||
// keydown,
|
keydown,
|
||||||
// keyup,
|
keyup,
|
||||||
// targets,
|
targets,
|
||||||
// ige,
|
ige,
|
||||||
// exit
|
exit
|
||||||
// }
|
}
|
||||||
|
|
||||||
// enum KeyType
|
enum KeyType
|
||||||
// {
|
{
|
||||||
// moveLeft,
|
moveLeft,
|
||||||
// moveRight,
|
moveRight,
|
||||||
// softDrop,
|
softDrop,
|
||||||
// rotateCCW,
|
rotateCCW,
|
||||||
// rotateCW,
|
rotateCW,
|
||||||
// rotate180,
|
rotate180,
|
||||||
// hardDrop,
|
hardDrop,
|
||||||
// hold,
|
hold,
|
||||||
// chat,
|
chat,
|
||||||
// exit,
|
exit,
|
||||||
// retry
|
retry
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class Event{
|
class Event{
|
||||||
// int id;
|
int id;
|
||||||
// int frame;
|
int frame;
|
||||||
// EventType type;
|
EventType type;
|
||||||
// //dynamic data;
|
//dynamic data;
|
||||||
|
|
||||||
// Event(this.id, this.frame, this.type);
|
Event(this.id, this.frame, this.type);
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// String toString(){
|
String toString(){
|
||||||
// return "E#$id f#$frame: $type";
|
return "E#$id f#$frame: $type";
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class Keypress{
|
class Keypress{
|
||||||
// KeyType key;
|
KeyType key;
|
||||||
// double subframe;
|
double subframe;
|
||||||
// bool released;
|
bool released;
|
||||||
|
|
||||||
// Keypress(this.key, this.subframe, this.released);
|
Keypress(this.key, this.subframe, this.released);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class EventKeyPress extends Event{
|
class EventKeyPress extends Event{
|
||||||
// Keypress data;
|
Keypress data;
|
||||||
|
|
||||||
// EventKeyPress(super.id, super.frame, super.type, this.data);
|
EventKeyPress(super.id, super.frame, super.type, this.data);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class IGE{
|
class Targets{
|
||||||
// int id;
|
String? id;
|
||||||
// int frame;
|
int? frame;
|
||||||
// String type;
|
String? type;
|
||||||
// int amount;
|
List<String>? data;
|
||||||
|
|
||||||
// IGE(this.id, this.frame, this.type, this.amount);
|
Targets(this.id, this.frame, this.type, this.data);
|
||||||
// }
|
|
||||||
|
|
||||||
// class EventIGE extends Event{
|
Targets.fromJson(Map<String, dynamic> json){
|
||||||
// IGE data;
|
id = json["id"];
|
||||||
|
frame = json["frame"];
|
||||||
|
type = json["type"];
|
||||||
|
data = json["data"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// EventIGE(super.id, super.frame, super.type, this.data);
|
class EventTargets extends Event{
|
||||||
// }
|
Targets data;
|
||||||
|
|
||||||
// class Hold
|
EventTargets(super.id, super.frame, super.type, this.data);
|
||||||
// {
|
}
|
||||||
// String? piece;
|
|
||||||
// bool locked;
|
|
||||||
|
|
||||||
// Hold(this.piece, this.locked);
|
class IGE{
|
||||||
// }
|
int id;
|
||||||
|
int frame;
|
||||||
|
String type;
|
||||||
|
int amount;
|
||||||
|
|
||||||
// class DataFullOptions{
|
IGE(this.id, this.frame, this.type, this.amount);
|
||||||
// int? version;
|
}
|
||||||
// bool? seedRandom;
|
|
||||||
// int? seed;
|
|
||||||
// double? g;
|
|
||||||
// int? stock;
|
|
||||||
// int? gMargin;
|
|
||||||
// double? gIncrease;
|
|
||||||
// double? garbageMultiplier;
|
|
||||||
// int? garbageMargin;
|
|
||||||
// double? garbageIncrease;
|
|
||||||
// int? garbageCap;
|
|
||||||
// double? garbageCapIncrease;
|
|
||||||
// int? garbageCapMax;
|
|
||||||
// int? garbageHoleSize;
|
|
||||||
// String? garbageBlocking; // TODO: enum
|
|
||||||
// bool? hasGarbage;
|
|
||||||
// int? locktime;
|
|
||||||
// int? garbageSpeed;
|
|
||||||
// int? forfeitTime;
|
|
||||||
// int? are;
|
|
||||||
// int? areLineclear;
|
|
||||||
// bool? infiniteMovement;
|
|
||||||
// int? lockresets;
|
|
||||||
// bool? allow180;
|
|
||||||
// bool? btbChaining;
|
|
||||||
// bool? allclears;
|
|
||||||
// bool? clutch;
|
|
||||||
// bool? noLockout;
|
|
||||||
// String? passthrough;
|
|
||||||
// int? boardwidth;
|
|
||||||
// int? boardheight;
|
|
||||||
// Handling? handling;
|
|
||||||
// int? boardbuffer;
|
|
||||||
|
|
||||||
// DataFullOptions.fromJson(Map<String, dynamic> json){
|
class EventIGE extends Event{
|
||||||
// version = json["version"];
|
IGE data;
|
||||||
// seedRandom = json["seed_random"];
|
|
||||||
// seed = json["seed"];
|
|
||||||
// g = json["g"];
|
|
||||||
// stock = json["stock"];
|
|
||||||
// gMargin = json["gmargin"];
|
|
||||||
// gIncrease = json["gincrease"];
|
|
||||||
// garbageMultiplier = json["garbagemultiplier"];
|
|
||||||
// garbageCapIncrease = json["garbagecapincrease"];
|
|
||||||
// garbageCapMax = json["garbagecapmax"];
|
|
||||||
// garbageHoleSize = json["garbageholesize"];
|
|
||||||
// garbageBlocking = json["garbageblocking"];
|
|
||||||
// hasGarbage = json["hasgarbage"];
|
|
||||||
// locktime = json["locktime"];
|
|
||||||
// garbageSpeed = json["garbagespeed"];
|
|
||||||
// forfeitTime = json["forfeit_time"];
|
|
||||||
// are = json["are"];
|
|
||||||
// areLineclear = json["lineclear_are"];
|
|
||||||
// infiniteMovement = json["infinitemovement"];
|
|
||||||
// lockresets = json["lockresets"];
|
|
||||||
// allow180 = json["allow180"];
|
|
||||||
// btbChaining = json["b2bchaining"];
|
|
||||||
// allclears = json["allclears"];
|
|
||||||
// clutch = json["clutch"];
|
|
||||||
// noLockout = json["nolockout"];
|
|
||||||
// passthrough = json["passthrough"];
|
|
||||||
// boardwidth = json["boardwidth"];
|
|
||||||
// boardheight = json["boardheight"];
|
|
||||||
// handling = Handling.fromJson(json["handling"]);
|
|
||||||
// boardbuffer = json["boardbuffer"];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class DataFullStats
|
EventIGE(super.id, super.frame, super.type, this.data);
|
||||||
// {
|
}
|
||||||
// double? seed;
|
|
||||||
// int? lines;
|
|
||||||
// int? levelLines;
|
|
||||||
// int? levelLinesNeeded;
|
|
||||||
// int? inputs;
|
|
||||||
// int? holds;
|
|
||||||
// int? score;
|
|
||||||
// int? zenLevel;
|
|
||||||
// int? zenProgress;
|
|
||||||
// int? level;
|
|
||||||
// int? combo;
|
|
||||||
// int? currentComboPower;
|
|
||||||
// int? topCombo;
|
|
||||||
// int? btb;
|
|
||||||
// int? topbtb;
|
|
||||||
// int? tspins;
|
|
||||||
// int? piecesPlaced;
|
|
||||||
// Clears? clears;
|
|
||||||
// Garbage? garbage;
|
|
||||||
// int? kills;
|
|
||||||
// Finesse? finesse;
|
|
||||||
|
|
||||||
// DataFullStats.fromJson(Map<String, dynamic> json){
|
class EndData {
|
||||||
// seed = json["seed"];
|
String reason;
|
||||||
// lines = json["lines"];
|
DataFull export;
|
||||||
// levelLines = json["level_lines"];
|
|
||||||
// levelLinesNeeded = json["level_lines_needed"];
|
|
||||||
// inputs = json["inputs"];
|
|
||||||
// holds = json["holds"];
|
|
||||||
// score = json["score"];
|
|
||||||
// zenLevel = json["zenlevel"];
|
|
||||||
// zenProgress = json["zenprogress"];
|
|
||||||
// level = json["level"];
|
|
||||||
// combo = json["combo"];
|
|
||||||
// currentComboPower = json["currentcombopower"];
|
|
||||||
// topCombo = json["topcombo"];
|
|
||||||
// btb = json["btb"];
|
|
||||||
// topbtb = json["topbtb"];
|
|
||||||
// tspins = json["tspins"];
|
|
||||||
// piecesPlaced = json["piecesplaced"];
|
|
||||||
// clears = Clears.fromJson(json["clears"]);
|
|
||||||
// garbage = Garbage.fromJson(json["garbage"]);
|
|
||||||
// kills = json["kills"];
|
|
||||||
// finesse = Finesse.fromJson(json["finesse"]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class DataFullGame
|
EndData(this.reason, this.export);
|
||||||
// {
|
}
|
||||||
// List<List<String?>>? board;
|
|
||||||
// List<String>? bag;
|
|
||||||
// double? g;
|
|
||||||
// bool? playing;
|
|
||||||
// Hold? hold;
|
|
||||||
// String? piece;
|
|
||||||
// Handling? handling;
|
|
||||||
|
|
||||||
// DataFullGame.fromJson(Map<String, dynamic> json){
|
class EventEnd extends Event{
|
||||||
// board = json["board"];
|
EndData data;
|
||||||
// bag = json["bag"];
|
|
||||||
// hold = Hold(json["hold"]["piece"], json["hold"]["locked"]);
|
|
||||||
// g = json["g"];
|
|
||||||
// handling = Handling.fromJson(json["handling"]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class DataFull{
|
EventEnd(super.id, super.frame, super.type, this.data);
|
||||||
// bool? successful;
|
}
|
||||||
// String? gameOverReason;
|
|
||||||
// int? fire;
|
|
||||||
// DataFullOptions? options;
|
|
||||||
// DataFullStats? stats;
|
|
||||||
// DataFullGame? game;
|
|
||||||
|
|
||||||
// DataFull.fromJson(Map<String, dynamic> json){
|
class Hold
|
||||||
// successful = json["successful"];
|
{
|
||||||
// gameOverReason = json["gameoverreason"];
|
String? piece;
|
||||||
// fire = json["fire"];
|
bool locked;
|
||||||
// options = DataFullOptions.fromJson(json["options"]);
|
|
||||||
// stats = DataFullStats.fromJson(json["stats"]);
|
|
||||||
// game = DataFullGame.fromJson(json["game"]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class EventFull extends Event{
|
Hold(this.piece, this.locked);
|
||||||
// DataFull data;
|
}
|
||||||
|
|
||||||
// EventFull(super.id, super.frame, super.type, this.data);
|
class DataFullOptions{
|
||||||
// }
|
int? version;
|
||||||
|
bool? seedRandom;
|
||||||
|
int? seed;
|
||||||
|
double? g;
|
||||||
|
int? stock;
|
||||||
|
int? gMargin;
|
||||||
|
double? gIncrease;
|
||||||
|
double? garbageMultiplier;
|
||||||
|
int? garbageMargin;
|
||||||
|
double? garbageIncrease;
|
||||||
|
int? garbageCap;
|
||||||
|
double? garbageCapIncrease;
|
||||||
|
int? garbageCapMax;
|
||||||
|
int? garbageHoleSize;
|
||||||
|
String? garbageBlocking; // TODO: enum
|
||||||
|
bool? hasGarbage;
|
||||||
|
int? locktime;
|
||||||
|
int? garbageSpeed;
|
||||||
|
int? forfeitTime;
|
||||||
|
int? are;
|
||||||
|
int? areLineclear;
|
||||||
|
bool? infiniteMovement;
|
||||||
|
int? lockresets;
|
||||||
|
bool? allow180;
|
||||||
|
bool? btbChaining;
|
||||||
|
bool? allclears;
|
||||||
|
bool? clutch;
|
||||||
|
bool? noLockout;
|
||||||
|
String? passthrough;
|
||||||
|
int? boardwidth;
|
||||||
|
int? boardheight;
|
||||||
|
Handling? handling;
|
||||||
|
int? boardbuffer;
|
||||||
|
|
||||||
// class TetrioRNG{
|
DataFullOptions.fromJson(Map<String, dynamic> json){
|
||||||
// late double _t;
|
version = json["version"];
|
||||||
|
seedRandom = json["seed_random"];
|
||||||
|
seed = json["seed"];
|
||||||
|
g = json["g"];
|
||||||
|
stock = json["stock"];
|
||||||
|
gMargin = json["gmargin"];
|
||||||
|
gIncrease = json["gincrease"];
|
||||||
|
garbageMultiplier = json["garbagemultiplier"];
|
||||||
|
garbageCapIncrease = json["garbagecapincrease"];
|
||||||
|
garbageCapMax = json["garbagecapmax"];
|
||||||
|
garbageHoleSize = json["garbageholesize"];
|
||||||
|
garbageBlocking = json["garbageblocking"];
|
||||||
|
hasGarbage = json["hasgarbage"];
|
||||||
|
locktime = json["locktime"];
|
||||||
|
garbageSpeed = json["garbagespeed"];
|
||||||
|
forfeitTime = json["forfeit_time"];
|
||||||
|
are = json["are"];
|
||||||
|
areLineclear = json["lineclear_are"];
|
||||||
|
infiniteMovement = json["infinitemovement"];
|
||||||
|
lockresets = json["lockresets"];
|
||||||
|
allow180 = json["allow180"];
|
||||||
|
btbChaining = json["b2bchaining"];
|
||||||
|
allclears = json["allclears"];
|
||||||
|
clutch = json["clutch"];
|
||||||
|
noLockout = json["nolockout"];
|
||||||
|
passthrough = json["passthrough"];
|
||||||
|
boardwidth = json["boardwidth"];
|
||||||
|
boardheight = json["boardheight"];
|
||||||
|
handling = Handling.fromJson(json["handling"]);
|
||||||
|
boardbuffer = json["boardbuffer"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TetrioRNG(int seed){
|
class DataFullStats
|
||||||
// _t = seed % 2147483647;
|
{
|
||||||
// if (_t <= 0) _t += 2147483646;
|
double? seed;
|
||||||
// }
|
int? lines;
|
||||||
|
int? levelLines;
|
||||||
|
int? levelLinesNeeded;
|
||||||
|
int? inputs;
|
||||||
|
int? holds;
|
||||||
|
int? score;
|
||||||
|
int? zenLevel;
|
||||||
|
int? zenProgress;
|
||||||
|
int? level;
|
||||||
|
int? combo;
|
||||||
|
int? currentComboPower;
|
||||||
|
int? topCombo;
|
||||||
|
int? btb;
|
||||||
|
int? topbtb;
|
||||||
|
int? tspins;
|
||||||
|
int? piecesPlaced;
|
||||||
|
Clears? clears;
|
||||||
|
Garbage? garbage;
|
||||||
|
int? kills;
|
||||||
|
Finesse? finesse;
|
||||||
|
|
||||||
// int next(){
|
DataFullStats.fromJson(Map<String, dynamic> json){
|
||||||
// _t = 16807 * _t % 2147483647;
|
seed = json["seed"];
|
||||||
// return _t.toInt();
|
lines = json["lines"];
|
||||||
// }
|
levelLines = json["level_lines"];
|
||||||
|
levelLinesNeeded = json["level_lines_needed"];
|
||||||
|
inputs = json["inputs"];
|
||||||
|
holds = json["holds"];
|
||||||
|
score = json["score"];
|
||||||
|
zenLevel = json["zenlevel"];
|
||||||
|
zenProgress = json["zenprogress"];
|
||||||
|
level = json["level"];
|
||||||
|
combo = json["combo"];
|
||||||
|
currentComboPower = json["currentcombopower"];
|
||||||
|
topCombo = json["topcombo"];
|
||||||
|
btb = json["btb"];
|
||||||
|
topbtb = json["topbtb"];
|
||||||
|
tspins = json["tspins"];
|
||||||
|
piecesPlaced = json["piecesplaced"];
|
||||||
|
clears = Clears.fromJson(json["clears"]);
|
||||||
|
garbage = Garbage.fromJson(json["garbage"]);
|
||||||
|
kills = json["kills"];
|
||||||
|
finesse = Finesse.fromJson(json["finesse"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// double nextFloat(){
|
class DataFullGame
|
||||||
// return (next() - 1) / 2147483646;
|
{
|
||||||
// }
|
List<List<String?>>? board;
|
||||||
|
List<String>? bag;
|
||||||
|
double? g;
|
||||||
|
bool? playing;
|
||||||
|
Hold? hold;
|
||||||
|
String? piece;
|
||||||
|
Handling? handling;
|
||||||
|
|
||||||
// List<Tetromino> shuffleList(List<Tetromino> array){
|
DataFullGame.fromJson(Map<String, dynamic> json){
|
||||||
// int length = array.length;
|
board = json["board"];
|
||||||
// if (length == 0) return [];
|
bag = json["bag"];
|
||||||
|
hold = Hold(json["hold"]["piece"], json["hold"]["locked"]);
|
||||||
|
g = json["g"];
|
||||||
|
handling = Handling.fromJson(json["handling"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// for (; --length > 0;){
|
class DataFull{
|
||||||
// int swapIndex = ((nextFloat()) * (length + 1)).toInt();
|
bool? successful;
|
||||||
// Tetromino tmp = array[length];
|
String? gameOverReason;
|
||||||
// array[length] = array[swapIndex];
|
int? fire;
|
||||||
// array[swapIndex] = tmp;
|
DataFullOptions? options;
|
||||||
// }
|
DataFullStats? stats;
|
||||||
// return array;
|
DataFullGame? game;
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// enum Tetromino{
|
DataFull.fromJson(Map<String, dynamic> json){
|
||||||
// Z,
|
successful = json["successful"];
|
||||||
// L,
|
gameOverReason = json["gameoverreason"];
|
||||||
// O,
|
fire = json["fire"];
|
||||||
// S,
|
options = DataFullOptions.fromJson(json["options"]);
|
||||||
// I,
|
stats = DataFullStats.fromJson(json["stats"]);
|
||||||
// J,
|
game = DataFullGame.fromJson(json["game"]);
|
||||||
// T,
|
}
|
||||||
// garbage,
|
}
|
||||||
// empty
|
|
||||||
// }
|
|
||||||
|
|
||||||
// List<Tetromino> tetrominoes = [Tetromino.Z, Tetromino.L, Tetromino.O, Tetromino.S, Tetromino.I, Tetromino.J, Tetromino.T];
|
class EventFull extends Event{
|
||||||
// List<List<List<Vector2>>> shapes = [
|
DataFull data;
|
||||||
// [ // Z
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(2, 1)],
|
|
||||||
// [Vector2(2, 0), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
|
||||||
// [Vector2(0, 1), Vector2(1, 1), Vector2(1, 2), Vector2(2, 2)],
|
|
||||||
// [Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(0, 2)]
|
|
||||||
// ],
|
|
||||||
// [ // L
|
|
||||||
// [Vector2(2, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
|
||||||
// [Vector2(1, 0), Vector2(1, 1), Vector2(1, 2), Vector2(2, 2)],
|
|
||||||
// [Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(0, 2)],
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(1, 2)]
|
|
||||||
// ],
|
|
||||||
// [ // O
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
|
||||||
// [Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)]
|
|
||||||
// ],
|
|
||||||
// [ // S
|
|
||||||
// [Vector2(1, 0), Vector2(2, 0), Vector2(0, 1), Vector2(1, 1)],
|
|
||||||
// [Vector2(1, 0), Vector2(1, 1), Vector2(2, 1), Vector2(2, 2)],
|
|
||||||
// [Vector2(1, 1), Vector2(2, 1), Vector2(0, 2), Vector2(1, 2)],
|
|
||||||
// [Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 2)]
|
|
||||||
// ],
|
|
||||||
// [ // I
|
|
||||||
// [Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(3, 1)],
|
|
||||||
// [Vector2(2, 0), Vector2(2, 1), Vector2(2, 2), Vector2(2, 3)],
|
|
||||||
// [Vector2(0, 2), Vector2(1, 2), Vector2(2, 2), Vector2(3, 2)],
|
|
||||||
// [Vector2(1, 0), Vector2(1, 1), Vector2(1, 2), Vector2(1, 3)]
|
|
||||||
// ],
|
|
||||||
// [ // J
|
|
||||||
// [Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
|
||||||
// [Vector2(1, 0), Vector2(2, 0), Vector2(1, 1), Vector2(1, 2)],
|
|
||||||
// [Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(2, 2)],
|
|
||||||
// [Vector2(1, 0), Vector2(1, 1), Vector2(0, 2), Vector2(1, 2)]
|
|
||||||
// ],
|
|
||||||
// [ // T
|
|
||||||
// [Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
|
||||||
// [Vector2(1, 0), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
|
||||||
// [Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
|
||||||
// [Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 2)]
|
|
||||||
// ]
|
|
||||||
// ];
|
|
||||||
// List<Vector2> spawnPositionFixes = [Vector2(1, 1), Vector2(1, 1), Vector2(0, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)];
|
|
||||||
|
|
||||||
// const Map<String, double> garbage = {
|
EventFull(super.id, super.frame, super.type, this.data);
|
||||||
// "single": 0,
|
}
|
||||||
// "double": 1,
|
|
||||||
// "triple": 2,
|
class TetrioRNG{
|
||||||
// "quad": 4,
|
late double _t;
|
||||||
// "penta": 5,
|
|
||||||
// "t-spin": 0,
|
TetrioRNG(int seed){
|
||||||
// "t-spin single": 2,
|
_t = seed % 2147483647;
|
||||||
// "t-spin double": 4,
|
if (_t <= 0) _t += 2147483646;
|
||||||
// "t-spin triple": 6,
|
}
|
||||||
// "t-spin quad": 10,
|
|
||||||
// "t-spin penta": 12,
|
int next(){
|
||||||
// "t-spin mini": 0,
|
_t = 16807 * _t % 2147483647;
|
||||||
// "t-spin mini single": 0,
|
return _t.toInt();
|
||||||
// "t-spin mini double": 1,
|
}
|
||||||
// "allclear": 10
|
|
||||||
// };
|
double nextFloat(){
|
||||||
// int btbBonus = 1;
|
return (next() - 1) / 2147483646;
|
||||||
// double btbLog = 0.8;
|
}
|
||||||
// double comboBonus = 0.25;
|
|
||||||
// int comboMinifier = 1;
|
List<Tetromino> shuffleList(List<Tetromino> array){
|
||||||
// double comboMinifierLog = 1.25;
|
int length = array.length;
|
||||||
// List<int> comboTable = [0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5];
|
if (length == 0) return [];
|
||||||
|
|
||||||
|
for (; --length > 0;){
|
||||||
|
int swapIndex = ((nextFloat()) * (length + 1)).toInt();
|
||||||
|
Tetromino tmp = array[length];
|
||||||
|
array[length] = array[swapIndex];
|
||||||
|
array[swapIndex] = tmp;
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Tetromino{
|
||||||
|
Z,
|
||||||
|
L,
|
||||||
|
O,
|
||||||
|
S,
|
||||||
|
I,
|
||||||
|
J,
|
||||||
|
T,
|
||||||
|
garbage,
|
||||||
|
empty
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Tetromino> tetrominoes = [Tetromino.Z, Tetromino.L, Tetromino.O, Tetromino.S, Tetromino.I, Tetromino.J, Tetromino.T];
|
||||||
|
List<List<List<Vector2>>> shapes = [
|
||||||
|
[ // Z
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(2, 1)],
|
||||||
|
[Vector2(2, 0), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
||||||
|
[Vector2(0, 1), Vector2(1, 1), Vector2(1, 2), Vector2(2, 2)],
|
||||||
|
[Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(0, 2)]
|
||||||
|
],
|
||||||
|
[ // L
|
||||||
|
[Vector2(2, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
||||||
|
[Vector2(1, 0), Vector2(1, 1), Vector2(1, 2), Vector2(2, 2)],
|
||||||
|
[Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(0, 2)],
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(1, 1), Vector2(1, 2)]
|
||||||
|
],
|
||||||
|
[ // O
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)],
|
||||||
|
[Vector2(0, 0), Vector2(1, 0), Vector2(0, 1), Vector2(1, 1)]
|
||||||
|
],
|
||||||
|
[ // S
|
||||||
|
[Vector2(1, 0), Vector2(2, 0), Vector2(0, 1), Vector2(1, 1)],
|
||||||
|
[Vector2(1, 0), Vector2(1, 1), Vector2(2, 1), Vector2(2, 2)],
|
||||||
|
[Vector2(1, 1), Vector2(2, 1), Vector2(0, 2), Vector2(1, 2)],
|
||||||
|
[Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 2)]
|
||||||
|
],
|
||||||
|
[ // I
|
||||||
|
[Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(3, 1)],
|
||||||
|
[Vector2(2, 0), Vector2(2, 1), Vector2(2, 2), Vector2(2, 3)],
|
||||||
|
[Vector2(0, 2), Vector2(1, 2), Vector2(2, 2), Vector2(3, 2)],
|
||||||
|
[Vector2(1, 0), Vector2(1, 1), Vector2(1, 2), Vector2(1, 3)]
|
||||||
|
],
|
||||||
|
[ // J
|
||||||
|
[Vector2(0, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
||||||
|
[Vector2(1, 0), Vector2(2, 0), Vector2(1, 1), Vector2(1, 2)],
|
||||||
|
[Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(2, 2)],
|
||||||
|
[Vector2(1, 0), Vector2(1, 1), Vector2(0, 2), Vector2(1, 2)]
|
||||||
|
],
|
||||||
|
[ // T
|
||||||
|
[Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(2, 1)],
|
||||||
|
[Vector2(1, 0), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
||||||
|
[Vector2(0, 1), Vector2(1, 1), Vector2(2, 1), Vector2(1, 2)],
|
||||||
|
[Vector2(1, 0), Vector2(0, 1), Vector2(1, 1), Vector2(1, 2)]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
List<Vector2> spawnPositionFixes = [Vector2(1, 1), Vector2(1, 1), Vector2(0, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)];
|
||||||
|
|
||||||
|
const Map<String, double> garbage = {
|
||||||
|
"single": 0,
|
||||||
|
"double": 1,
|
||||||
|
"triple": 2,
|
||||||
|
"quad": 4,
|
||||||
|
"penta": 5,
|
||||||
|
"t-spin": 0,
|
||||||
|
"t-spin single": 2,
|
||||||
|
"t-spin double": 4,
|
||||||
|
"t-spin triple": 6,
|
||||||
|
"t-spin quad": 10,
|
||||||
|
"t-spin penta": 12,
|
||||||
|
"t-spin mini": 0,
|
||||||
|
"t-spin mini single": 0,
|
||||||
|
"t-spin mini double": 1,
|
||||||
|
"allclear": 10
|
||||||
|
};
|
||||||
|
int btbBonus = 1;
|
||||||
|
double btbLog = 0.8;
|
||||||
|
double comboBonus = 0.25;
|
||||||
|
int comboMinifier = 1;
|
||||||
|
double comboMinifierLog = 1.25;
|
||||||
|
List<int> comboTable = [0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5];
|
||||||
|
|
Loading…
Reference in New Issue