Giter Site home page Giter Site logo

fighting's People

Contributors

dugabot avatar zomis avatar

Watchers

 avatar  avatar

fighting's Issues

Store logs

It might be useful in #3 to export the entire logs of all objects that was posted to the extractor

Multiple indexes

Related to #11. Add support for one object being able to create multiple indexes.

Something like:

public static class IndexExample {
    Function<String, char[]> endingChar = str -> new char[]{ str.charAt(0), str.charAt(str.length() - 1) };
    ToIntFunction<String> length = str -> str.length();
}

Extractor extractor = Extractor.extractor(new IndexExample());
extractor.postPrimary().post("teat");
extractor.postPrimary().post("af");
IndexableResults results = extractor.collectIndexable();
data = results.indexBy("endingChar");

data should now contain something like:

endingChar=a : { size = 2 }
endingChar=f : { size = 2 }
endingChar=t : { size = 4 + 4 }

Note that because teat both begins and ends with 't', that data is added twice to that index.

Dynamic adding of functions and collectors

At the moment all collectors and functions and stuff needs to be declared in a class. This is a big limitation for a more dynamic usage of the extraction.

Make it possible to dynamically add functions and collectors to the class

Something like:

Extractor extractor = new Extractor();
extractor.add(ToIntFunction.class, String.class, str -> str.length());

Graphs

Using the JavaScript library 'flot', it can be possible to add support for graphs

README

Add README with information about what's possible with this library, and how to do it.

Kotlin flows

This would benefit greatly from Kotlin flows.

However, I would wonder if there's a risk that this project might become "too abstract" and not provide any real value? This is something to look out for here.

Posting and notifying about superclasses

Let's say that you have classes A and B, where B extends A:

class A {
    public int getValue() {
         return 42;
    }
}
class B extends A {   }

And the following extract setup:

public class Extract {
    ToIntFunction<A> someValue = a -> a.getValue();
}

Extractor extractor = Extractor.create(new Extract());

It should now be possible to post an object of class B and also inform the ToIntFunction that uses A.

extractor.post(new B());

Export to HTML

After a run, it should be possible to export the retrieved data to HTML

Tree drag-drop to change indexation

With a combination of #5 and #3 , it could be possible to dynamically, in the exported file, re-arrange the indexation, so that you can try to find other patterns when looking at the data, without having to change the code that creates the data.

Use a tree for indexation

It should be possible to index results acquired from #1 in a neat way, for example like the current, "new", style:

Fights
    Data: {WinnerCastle=17.683333333333334, Wins=120: 0/120/0 (50.00 %)}
    Player CWars2AI_InstantWin: 
        Data: {WinnerCastle=16.375, Wins=60: 40/0/20 (66.67 %)}
        Opponent CWars2AI_Better: 
            Data: {WinnerCastle=17.9, Wins=20: 10/0/10 (50.00 %)}

Checkboxes to choose what to display

In #3, it would be nice to have an ability to show/hide various statistics. Perhaps you are only interested to see the total damage dealt and not the average number of resources used per turn.

Also applies to possible sub-stats, for example on a Map<Resource, IntSummaryStatistics>, add a checkbox on each Resource.

Skip some collecting

Let's say there's a big huge collecting class:

public static class Example {
    ToIntFunction<String> length = str -> str.length();
    ToIntFunction<String> numA = str -> (int) str.chars().filter(ch -> ch == 97).count();
    ToIntFunction<Character> charValue = ch -> ch.charValue();
    ...
}

And you don't want to collect all of those fields, then use a skip method to clear those.

Extractor extractor = Extractor.extractor(new IndexExample());
extractor.skip("numA");

Alternatively, use the inheritance from #9 and use @IgnoreStat annotations or similar

Filter collecting with predicate

As a way of filtering what data is collected, add a @Predicate annotation with a reference to a field with a predicate, to determine whether or not to collect the data.

Predicate<String> pred = s -> s.length() > 10;

@Predicate("pred")
ToIntFunction<String> len = s -> s.length();

In this case, len will only consider strings with more than 10 length.

Indexation

It should be possible to group statistics into various indexes.

For example:

public static class IndexExample {
    Function<String, Integer> sizeIndex = str -> str.length();
    Function<String, Character> firstLetter = str -> str.charAt(0);

    ToIntFunction<String> length = str -> str.length();
    ToIntFunction<String> numA = str -> (int) str.chars().filter(ch -> ch == 97).count();
}

And the code/data:

    Extractor extractor = Extractor.extractor(new IndexExample());
    extractor.post("teat");
    extractor.post("a_a_");
    extractor.post("tca");
    extractor.post("abc");
    extractor.post("aaa");

This should produce something like:

Unindexed: { length = 4+4+3+3+3, numA = 1+2+1+1+3 }
size=3: { length = 3+3+3, numA = 1+1+3 }
size=4: { length = 4+4, numA = 1+2 }
firstLetter=t: { length = 4+3, numA = 1+1 }
firstLetter=a: { length = 4+3+3, numA = 2+1+3 }
size=3,firstLetter=a: { length = 3+3, numA = 1+3 }
size=3,firstLetter=t: { length = 3, numA = 1 }
size=4,firstLetter=a: { length = 4, numA = 2 }
size=4,firstLetter=t: { length = 4, numA = 1 }

Because of the enormous amount of combinations, and to support #6, all the data for all the index should probably be stored, and then filters and indexes can be applied on the raw data. Possibly use JSON as format for the raw data.
#5 is about exporting to HTML, this is different as it is about supporting it in the core.

Use event-based extracting mechanism

Example code:

public class Example {
    ToIntFunction<String> length = str -> str.length();
    ToIntFunction<String> numberOfAs = str -> str.chars().filter(ch -> ch == 65).count();
}

This would then be collected in a result as a IntSummaryStatistics (Java 8 has a collector for this).

Code to do the collecting:

Extractor extract = new Extractor();
extract.post("test");
extract.post("Hello World");
extract.post("yet another message");
ExtractorResults results = extract.collect();

Multiple threads

In most cases it should be possible to run fights in multiple threads.

Support stats inheritance

Consider this:

public static class Example {
    ToIntFunction<String> length = str -> str.length();
    ToIntFunction<Character> charValue = ch -> ch.charValue();
}

public static class IndexExample extends Example {
    ToIntFunction<String> numA = str -> (int) str.chars().filter(ch -> ch == 97).count();
}

It should be possible to perform extraction with SecondExample and include all the things from Example.

If naming collisions occur, either throw an exception, or solve collisions by prepending the class name, such as IndexExample::something and Example::something (but then there's the possibility of two classes with the same name in separate packages, sigh... okay, exception it is!)

Rating collect

It would be nice to collect information about what rating for players would be after a series of games has been played.

The bad thing about this is that it is dependent on the order of the games.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.