Evolutive neural network on Super Mario World - artificial-intelligence

I'm trying to run this application of the NEAT algorithm so it can play SMW, but instead it just stays on the select level section, where it can not learn anything. It work with the EmuHawk and a LUA console that the emulator provides. Here's the link for the source code: https://pastebin.com/ZZmSNaHX
Link for EmuHawk: https://github.com/TASEmulators/BizHawk-Prereqs/releases
And link for the SMW: [Link removed]
[enter image description here] (https://i.stack.imgur.com/Y96YK.png)
Here u can see how it is on the like 300 spieces genome 3 but it just won't learn anything on that section. I need him to play.
I tried to change the config for the DP1.STATE but it won't work, 'cause that was the first thing causing issues on the program "NLua.Exceptions.LuaScriptException: [string "main"]:35: attempt to get length of global 'ButtonNames' (a nil value)" bu it's already fixed.

Related

CSFML : Draw Line

i'm working on a school project using CSFML (The SFML library but in C), i'm trying to display a line between two points but impossible for me to find any good documentation to do it, if someone know how to do it, please help me.
i've got his doc:
https://www.sfml-dev.org/tutorials/2.0/graphics-shape-fr.php
and my code look like this:
sfRenderWindow_clear(window.window, sfBlack);
sfRectangleShape *rectangle = sfRectangleShape_create();
sfRectangleShape line(rectangle);
sfRenderWindow_display(window.window);
but there is nothing on my window.
The doc tell something like window.draw(); to draw it but it's not recognized as a valid function so...
Thank you

Lua, Love2d, two games with the same class name in different folders

I'm new to Lua and Love2D, I did 2-3 simple games and I wanted to put them together. I did a window where you choose which game you want to play. It succeed; with a little problem. Two of my games use a ball. So both have a Ball.lua File. I use the require function to load the Ball file in each of my games. It works at first, I can play Game1, go back and play Game2 without any problem. But if I go back and want to play the Game1 again. His ball.lua File will not be required since require only load once. Then there will have an error since my game1 is trying to use my Game2's ball Class.
I wanted to know which solution would be best :
Just rename the files. (I would like to avoid it, feels hardcoding to me)
Use doFile. (I never used it, I don't even know if it would work)
Require the two Ball's Classes in my Main menu and pass it by parameter when loading each game (Don't know if it would work too)
If you want to see my code for more explanation, here's the link : https://github.com/cbelangerstpierre/Games/tree/main/Games
Thanks in advance !
As you know, require will only execute each file once. However it will also save the return value of the file so you can require the file as many times as you want and still get the same value.
In your Ball.lua files, make your Ball declarations local:
local Ball = Class{}
Then at the bottom of those files add:
return Ball
Then, change your main.lua files to store to the global Ball variable:
Ball = require "Atari-Breakout.Ball"
and
Ball = require("Switching-Ball.Ball")
Ideally, it's recommended to make all of your variables local and return tables from the files that you need to require.

Running multiple bibliographies with TexnicCenter

I am using a couple of files letters.bib and thesis.bib for my bibliography and using the multibib environment and running latex via TexnicCenter Editor. But, I am unable to see the result in the end. My sample code :
\usepackage{multibib}
\newcites{Thesis, Letters}{Thesis, Letters}
\begin{document}
~\citeThesis{thesis01}
~\citeLetters{letter01}
\bibliographyThesis{thesis}
\bibliographyLetters{letters}
\end{document}
How can I get it to work multibib with TexnicCenter ?
Looks like there's a way around with Texnic Center. Usually when I ask it to generate PDF, it does so, but without the citation links the first time. When I do it second time, it produces the citation links.
This is an interesting problem, probably Texnic Center has to be reconfigured. Here's the solution.
Based on the code above, two aux files named Thesis.aux and Letters.aux gets produced.
Open them in TexnicCenter and under Build > CurrentFile > BibTex, it should be done for each of Thesis.aux and Letters.aux separately.
Once, (2) is done, generate the PDF, you should see the result.

How to indicate an word exception for stemming in Hunspell

I am using Hunspell to stem words for a SOLR instance. For the most part, it seems to be working well.
I'm using the OpenOffice dic/aff files.
However, there are some notable word exceptions, and I'd like to be able to remove these as candidates for stemming.
A great example is "skier", which stems to "sky" because of the following:
in the .dic file
sky/MDRSGZ
relevant rule in the .aff file
SFX R y ier [^aeiou]y
Is there any way to indicate that skier and only skier should be left alone?
Yeah this is a very common thing, just remove the "R"
sky/MDSGZ
But you may then want to add back in on another line "skier" and any other versions of it.
skier/MS
I have had to make numerous changes to this file, and now really wish there was a better option.
For example
Butter -> Butt
Corner -> Corn
Easter -> East
And then another one that is really confusing,
Wind == Wound
On my site before we fixed it if you searched for wind like in "wind power" you ended up with a bunch of bruises and bloody wounds.
Because "wound" like in "I wound the clock" stemmed to wind.
We also decided to remove all RE prefixes. because things like
remarkable -> mark
remove -> move
reset -> set
restore -> store
So if you know of a better dictionary that is better for this please let me know. (I think the main problem is this dictionary is more intended for spell check then for stemming)
I would be willing to start and/or contribute to a git project for a real stemming dictionary to replace this spelling dictionary for everyone out there using this.
have you tried freeling? It is open sourced.
A demo page is here:
http://nlp.lsi.upc.edu/freeling/demo/demo.php
When I pick english, pos tagging I get the following result:
you wound the clock?
you wind the clock?
PRP VBD DT NN ?
also skier, wind power all get the noun stems. It is a great stemmer and analyzer.
not sure about licensing. the download page:
http://devel.cpl.upc.edu/freeling/downloads?order=time&desc=1

Understanding parsing SVG file format

First off, gist here
Map.svg in the gist is the original Map I'm working with, got it off wikimedia commons.
Now, there is a land mass off the eastern cost of Texas in that original svg. I removed it using Inkscape, and it re-wrote the path in a strange new way. The diff is included in the gist.
Now this new way of writing the path blows up my parser logic, and I'm trying to understand what happened. I'm hoping someone here knows more about the SVG file format that I do. I will admit I have not read through the entire SVG standard spec, however the parts of it I did read didn't mention anything about missing commands or relative coordinates. Then again I may have been looking at the incorrect spec, not sure.
The way I understood it, SVG path data was very straight forward, something like this:
(M,L,C)[point{n}] .... [Z] then repeat ad-nauseum
Now the part I'm trying to understand is this new Inkscape has written out what seems like relative coordinates, without commands like L, or L being implied somehow. My gut is telling me what has happened here is obvious to someone. For what it's worth I'm doing my parsing in C.
If you're parsing SVG, why not look at the SVG specification?
Start a new sub-path at the given (x,y) coordinate. M (uppercase) indicates that absolute coordinates will follow; m (lowercase) indicates that relative coordinates will follow. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands.
From: http://www.w3.org/TR/2011/REC-SVG11-20110816/paths.html#PathDataMovetoCommands
You said,
The way I understood it, SVG path data was very straight forward, something like this: (M,L,C)[point{n}] .... [Z]
I don't know where you got that information. Stop getting your information from that source.
I will admit I have not read through the entire SVG standard spec...
Nobody reads the entire spec. Just focus on the part you're implementing at the moment. You could also start with SVG Tiny, and work with that subset for now.
Path Grammar is where you should start when writing a parser. If you can't read it, then buy a book on compilers.
Path grammar: http://www.w3.org/TR/2011/REC-SVG11-20110816/paths.html#PathDataBNF

Resources