<< Back to General Forum   Search

Posts 1 - 22 of 22   
Warlight Analysis Tool: 3/12/2014 20:13:55


125ch209 
Level 58
Report
Hi all

I wrote a little program using Matlab.Nothing too fancy, it is basically an extention of the "analyze attack" tool in the game. I'm not a programmer so the code must be terrible but it works for me, so i might as well share it.

the program has 3 features:
the rounding mode is weighted random, maybe i'll add the straight round option later

- Army losses analysis: gives you the spectrum of kills. For example, if you attack a territory defended by 10 armies, the "analyze attack" tool in the game will tell you that you will lose about 7 armies, while this program will tell you that you have 9% chance of losing 6 armies, 82% chance of losing 7, and 9 % chance of losing 8.

- Taking Territory Analysis: basicaly the same graph you have in the "analyze attack" tool ingame, exept i use the maths formulas to get the graph, not simulations that gives you an average graph, so the graph in the program should be a bit more precise than in the "analyze attack" tool in the game. However, if you put more than 100 defending armies, the program will be extemely slow to get you the graph.

- Custom scenario analysis: allows you to analyze some basic scenarios and gives you the expected payoff of the scenario.


From what i read on the internet, if the PC doesn't have matlab installed, the program won't run. In order to run it you have to install Matlab Compiler Runtime (MCR). I didn't try the program on another PC, so i don't know if it will work. I have Windows 7 x64, so i don't know if it will work on other version of windows.

link to the program (last version) (242ko): https://www.dropbox.com/s/zs3m1hm3cx291zd/WarlightAnalysis12.exe
test it without MCR and see if it works (doubt it)
code in docx:
https://www.dropbox.com/s/39sju8bwc161inq/CodeWarlightAnalysis12.docx
source code:
https://www.dropbox.com/sh/u2to8nnywafolfc/0MEPlwgyWm
link to the MCR (174Mo): https://www.dropbox.com/s/srizpggkjyd64tn/MCRInstaller.exe
I know it sound stupid to install the 174Mo MCR to run a 242ko program but i don't have other option available. I am trying to find a way to make a real stand alone .exe







Edited 3/14/2014 02:11:31
Warlight Analysis Tool: 3/12/2014 20:24:43

Fizzer 
Level 58

Warzone Creator
Report
That looks pretty cool, but you really should distribute the source code. Running exe's from strangers on the internet is dangerous, and in general I wouldn't recommend it. For all we know the program could be a virus or it could be stealing our WarLight logins. People have tried to do this before, so it's not just paranoia.
Warlight Analysis Tool: 3/12/2014 20:44:09


125ch209 
Level 58
Report
how do i distribute the source code? you mean the .m file? or i just copy/paste the lines in a text editor.
btw the code is so messy, i don't see how anyone could understand what i did. This is only the 2nd time i tried to do some programming, i don't know the first thing about C++ or other languages

Edited 3/12/2014 20:47:50
Warlight Analysis Tool: 3/12/2014 21:50:42


125ch209 
Level 58
Report
i added the source code
Warlight Analysis Tool: 3/12/2014 22:12:54


<SNinja>gg
Level 31
Report
what is mat lab coded in?
Warlight Analysis Tool: 3/12/2014 22:19:40


125ch209 
Level 58
Report
I don't know, but apparently it uses a lot of different languages:
http://www.walkingrandomly.com/?p=4333
Warlight Analysis Tool: 3/13/2014 00:34:59


125ch209 
Level 58
Report
anyone tested it and can tell me if it works?
Warlight Analysis Tool: 3/13/2014 00:47:34


Mr. Gentleman*SEAHAWKSWONSUPERBOWLXLVIII*
Level 58
Report
Not a slight against you but you probably shouldn't advertise you have really messy code. If you feel insecure about it call it an alpha stage. So people can be aware that there may be unintended issues related to messy code.

Also it was a good idea to put your source code up ;) that way others can clean it up a bit. I'll have my wife take a look at it see what she can do. She writes really clean code. Although when she gets around to it I have no idea lol.

Also seems like a really good idea should help the less math oriented folks around a bit.
Warlight Analysis Tool: 3/13/2014 01:18:33


125ch209 
Level 58
Report
what i meant by messy is that there is 2449 lignes in the code, while i'm sure 300/400 lines would have sufficed for someone that know his way around matlab better than me. I did a lot of copy/pasted lines when i needed to change one or two parameter, and there is also a lot of lines that i put as "comment" and that are not used. Those lines were for other features i wanted to add but that didn't work too well. I just let them there in case i go back to it. Other than that, the code works fine, it may be slower than it should, but all i really care is that the program work and the results are accurates.

Edited 3/13/2014 01:23:11
Warlight Analysis Tool: 3/13/2014 01:25:11


Mr. Gentleman*SEAHAWKSWONSUPERBOWLXLVIII*
Level 58
Report
Yeah I didn't mean to say that it was bad. ;)

You can't be to sure when someone says the code is messy lol.
Warlight Analysis Tool: 3/13/2014 01:57:29


<SNinja>gg
Level 31
Report
i have not looked at the code (i am a noob coder though) but is there no way you could variables to change it? and combine that with functions? it may not work but when you are ctrl. c and ctrl. v see if there is a way to add more variables and functions... but not always

EDIT: also can you put it in a google doc so i can check it out? thanks

Edited 3/13/2014 01:59:15
Warlight Analysis Tool: 3/13/2014 02:20:09


125ch209 
Level 58
Report
yes i should have use functions, but in matlab from what i understood functions have to be defined in a separated file and then call them in you code. For every little thing i wanted to do i had to watch a video or check a tutorial on how to do it, since i am a complete noob in coding.Frankly i didn't know it would be so complicated to code this little program, i thought it would be easy but before i knew it i was crawling under lines and lines of code. I'll put the code in a google doc, but a lot of lines in there were generated by the graphic user interface feature in matlab.

edit: i added the link of the code in a docx

Edited 3/13/2014 02:38:35
Warlight Analysis Tool: 3/13/2014 02:32:34


<SNinja>gg
Level 31
Report
ohh that's a pain to use a function... seems a little ridicules to me as it is a staple of coking...
Warlight Analysis Tool: 3/13/2014 02:35:33


125ch209 
Level 58
Report
did you test the program?
Warlight Analysis Tool: 3/13/2014 02:45:44


<SNinja>gg
Level 31
Report
i can't download it right now... i may try later but i am more interested in learning what i can from the code
Warlight Analysis Tool: 3/13/2014 02:50:05


125ch209 
Level 58
Report
i put the link to the docx file with the code, tho you should note that the first 300 lines are not mine, they were automatically generated by the GUI (graphic user interface)
https://www.dropbox.com/s/jg6ss7m1vjeuxaw/code.docx
Warlight Analysis Tool: 3/13/2014 13:39:11


∀ÆGÜSTUS∀
Level 55
Report
Looks awesome 125CH209 :) nice work~~ xD
Warlight Analysis Tool: 3/14/2014 02:13:55


125ch209 
Level 58
Report
I modifed the code to include functions, so now it is clean and readable (see the docx).It droped from to 2449 lines to about 900 lines. I'd be glad if someone could test it and tell me if it works
Warlight Analysis Tool: 3/14/2014 11:45:13


nich 
Level 59
Report
I've had no luck trying to run it so far. MATLAB says functions are nested too deeply then loses its mind over where it thinks
end
shouldn't be.
What version of MATLAB are you using? I'd love to have a poke around once I get it working for me.
Warlight Analysis Tool: 3/14/2014 14:36:49


125ch209 
Level 58
Report
did you run the .exe or the .m files?
did you put the 4 .m files and the .fig file all in the same folder?I'm using MATLAB R2010b
Warlight Analysis Tool: 3/14/2014 16:29:56

[16] b3rz3rk3r
Level 56
Report
It works for me in matlab R2007B. (using the Source Code zip from dropbox)

Also thanks for making this tool.
Warlight Analysis Tool: 3/14/2014 18:39:20


125ch209 
Level 58
Report
cool, did you try the .exe? i promise there isn't any virus lol
Posts 1 - 22 of 22