=========================================================================================================================================
   Star Wars X-Wing Miniatures: Ship AI Combined 1st and 2nd Edition and Heroes of the Aturi Cluster (HotAC) + Flight Group Alpha (FGA) AI 2nd Edition

            1st Edition AI v1.14.0 / 2nd Edition AI v2.2.3 / HoTAC+FGA 2nd Edition (2.07.04/205_001/AI7.2) AI v3.1.5
=========================================================================================================================================

-------------------
Standard Disclaimer
-------------------

Star Wars and all associated elements are copyright 2015 Lucasfilm Ltd. & TM. All rights reserved.
Fantasy Flight Games and the FFG logo are trademarks of Asmodee/Fantasy Flight Publishing, Inc.

You use this software at your own risk, the authors are not responsible for any loss or damage resulting from the use of this software. If you do not agree with these terms do not use this software, simple.

--------
Overview
-------

Simple web based for AI control of ships in the "Star Wars x-Wing Miniatures game" for both 1st and 2nd Edition rules.

New AI built to match Heores of the Aturi Cluster Rebel Cooperative Campaign Game (original by Josh Derkson, updated to 2nd Edition by Shaun Tiernan,
Imperial A.I. courtesy of Flight Group Alpha and Claes Sorennson) and Flight Group Alpha Imperial Cooperative Campaign by Claes Sorrenson and Flight Group Alpha
Campaign Book and Mission Pack Layout courtesy of Bill Waller
Elite Pilot Cards and Player Record Cards Layout courtesy of Justin Gan
Playtesting by Recon Specialists - Patrick Patrick and Padre
Additional Pilot Ability Cards by Dovi Anderson

You can download HotAC 2nd Edition (v 2.07.0.5) and the Ground Assault Expansion materials at:

https://drive.google.com/drive/folders/1TC5fOPazzRoXpvrqQr5PBWvjiyME_ryk?fbclid=IwAR24y_sBkAlgSJw36iB7sZfjOzTOLzo82Tf9L2rJd1xrVAc1TJcuHpBX720

You can download FGA 2nd Edition (Ver 205_001 with AI Ver 7.3) at:

https://boardgamegeek.com/filepage/229173/flight-group-alpha-imperial-co-operative-campaign

Do check out the HotAC/FGA Facebook page here:

https://www.facebook.com/groups/872507722883025

--------------------
Installation / Usage
--------------------

Extract zip file to any location
Open "index2.htm" in a browser to use X-Wing 2nd Edition AI or open "index.htm" in a browser to use original X-Wing 1st Edition AI, or open "index3.htm in a browser to use HotAC+FGA AI 2nd Edition.
You can switch between 1st Edition, 2nd Edition or HotAC+FGA AI by clicking the small yellow "AI" icon on the top right side of any page.
Click the "?" button for detailed instructions on using the applications
Click on the "i" button for info about x-wing-ai
Click on the "star" button to get back to the current AI main page.
Click on the "ship" button to get to the "Ship" page to get a detailed breakdown of maneuvers and actions for any ship

--------------
Change History
--------------
10/17/2012	1.1.0	Added Multiple ship support and AI for Tie Advanced and X-Wing
10/27/2012	1.2.0	Converted several images to smaller files, Added infrastructure for Wave-2 ships
10/29/2012	1.3.0	Added Y-Wing AI, Converted from radio to image buttons for ships
01/09/2013	1.4B1	Added YT-1300 and Firespray-31
					Fixed TieInteceptor image name case-sensitivity problem
01/12/2013	1.4.0	Added AU for A-Wing and Tie Interceptor
					Added actions section to main page
01/17/2013	1.4.1	Fixed ship selection bug, was always selecting TieFighter table
02/09/2013	1.5.0	Added "far" maneuvers for use when AI ship is outside target range
					Added Ships details page, Minor reformatting
					Display maneuvers as images instead of text
					Converted to a simplified selection (ring) method
02/08/2014	1.6.0b1	Added Wave 3 Ships (B-Wing, Tie Bomber, HWK-290, Lambda Shuttle)
					Maneuvers for B-Wing and HWK-290, but Tie Bomber and Lambda Shuttle still pending.
					Improved Ring display on Firefox
					Added Version display on all pages
02/20/2014	1.6.0b2	New method for generating maneuver tables
					Maneuvers for all three waves (first for Lambda Shuttle and Tie Bomber
03/03/2014	1.6.0	Adjusted Lambda Shuttle maneuvers to have a few less Red moves
06/18/2014	1.7.0b1	Adding Wave 3.5 and 4 Ships: E-wing, Z95, Tie Defender, Tie Phantom, Corvette, Transport
					Added faction buttons, separate which ships are shown
					Added hover text for all ship buttons
					Added label for select ship name
					Added images for actions
					Added stressed maneuvers
06/26/2014	1.7.0b2	New faction specific target ring images
08/05/2014	1.7.0b3 Fix Tie Defender Korigan maneuver is white, not red
					Page formatting and labels to make choices clearer
11/16/2014	1.8.0	Adding Wave 5 Ships: YT-2400 and VT-49 Decimator
12/12/2015	1.9.0	Adding Wave 6 Ships: Ig2000, M3A, StarViper
  					Adding Wave 7 Ships: Hound’s Tooth, Kihraxz Fighter, K-Wing, Tie Punisher
  					Adding Wave 8 Ships: Ghost, Inquisitor’s Tie, Mist Hunter, Punishing One
12/13/2015	1.9.0.1 Added Force Awakens Ships: T-70 X-Wing, TIE/fo
  					Disable Wave 8 ships and Imperial Huge Ship (until maneuvers are available)
06/12/2016	1.9.0.2 Update Ship images: Mist Hunter, Phantom, Punishing One, Inquisitor's Tie
                    Added PunhishingOne Maneuvers
                    Cleaned up Segnor Loop images
03/04/2017  1.10.0  Adding Wave 9 and 10 ships

01/21/2019  1.14.0 (Tomcattwo) Added waves 11 through 14 ships; fixed Mist Hunter in wave 8 to correct maneuvers

01/21/2019  1.14.01/2.0.2   (Tomcattwo) Added complete 2nd Edition AI. This includes all ships/waves, updated to 2nd edition maneuvers and actions (drawn from http://xhud.sirjorj.com/xwing.cgi) and combined 1st Ed. v1.14.0 and 2nd Ed. 2.0.0 into a single distributable package. Added icons to both 1st and 2nd editions to allow switching back and forth between them. Now the entire package can be distributed in a single distributable, and the user can elect to use the older 1st edition ruleset and AI or 2nd edition ruleset with 2nd edition AI.

02/03/2019  1.14.01/2.0.2   (Tomcattwo) Updated version to 2.0.1.
                           Put TIE/SF and Upsilon Class Shuttle in First Order Faction where they belong and removed from Empire Faction.
                           Minor update to 2nd edition files to remove Scurrg H-6 Bomber from Rebel inventory and Firespray from Empire Inventory - per 2nd Edition ruleset.
                           Changed Index2 to show Rebel faction first on main page and ships page, to align all the "good guys" (Rebel, Scum, Rebellion, Republic) on the left and all the "bad guys" (Empire, First Order, Seperatist) on the right.
                           Minor change to Info2 file in Dedication
                           No changes to 1st edition files
5/19/2020  1.14.01/2.0.2    (Tomcattwo) Updated 2nd Edition AI to version 2.0.2. This was a major update which included:

			   1) Added ships for 2nd Edition Wave 4 (Hyena, Naboo N-1, Resistance Transport, Resistance Transport Pod (including Droid Pilot Variants), Wave 5 (BTL-B Y-Wing, Nantex Starfighter), Wave 6 (Fireball Racer, Maj Baron von Reg's TIE/ba), and Wave 7 (HMP Droid Gunship, LAAT/i, Xi-class Light Shuttle). 
			   2) Updated "huge" ships to delete Imperial Carrier, and added Gozanti and C-ROC cruisers (and faction variants).
			   3) Changed the way ship actions are generated by python in the compiler, and the way ship actions are identified in the xwingAI2.js file. In the original AI, ship actions were identified within the xwingai2.js file by the use of a primitive bitwise number (primitive enumeration) generated by the python code for each ship from its .xml file entry. The number represented the concatenation of all specific actions available for each ship, and was matched using bitmap comparison within the xwingai2.js file as a ship was selected. This worked fine, until the total number of actions for any/all x-wing miniatures ships/cards exceeded 31, because primitive "enumerated" bitmaps can only represent a maximum of 31 unique items. In order to get over this limitation, I changed ALL actions for ships to an array of strings for each individual ship (instead of the single number of a concatenated enumerated bitwise mapping). With this change, the number of possible actions is virtually unlimited, and the code to identify a selected ship's potential actions is much simpler and easier to maintain/add to as future new actions come about. This was a significant change which required changes to the python files (ship.py, generate.py), every ship in every .xml file (19 files, 85 unique ships/variants, including the new wave 5-7 files) and extensive code changes to the xwing_ai2.js file. While this was a lot of work, the results are worth the effort. Actions now work properly and are correctly represented (based on sirjorj's cgi xHUD website - http://xhud.sirjorj.com/xwing.cgi), and are better ordered to help the player identify the best action(s) to have the AI take to provide a more challenging game.
			   4) Added "Tooltips" for all icons in the Actions section of the AI page. Makes it easier for those who may be unfamiliar with all of the various action icons. Just hover the cursor over any icon to see the name of the action.
			   5) Changed the factions to be capitalized on the AI2 main screen (e.g., "Rebel" vice "rebel" and "First Order" vice "1storder"). This required changes to the following files: generate.py, every ship in every .xml file (19 files, 85 unique ships/variants, including the new wave 5-7 files) and minor code changes to the xwing_ai2.js file.
			   6) Updated all HTML pages for Tooltips for all icons. Minor updates to AI2 Help page to clarify instructions
			   7) No changes to 1st edition non-HTML files or stylesheet.

6/05/2020 1.14.01/2.0.2     Minor update to fix an incorrect maneuver for 1 ship.

6/10/2020 1.14.01/2.0.2/3.0.0 (Tomcattwo) Added an entirely new AI for "Heroes of the Aturi Cluster" (HotAC) Rebel cooperative campaign game. HotAC for 1st edition was designed by Josh Derkson.
HotAC for 2nd Edition rules was updated by Shaun Tiernan, assisted by Claes Sorrenson and the members of Flight Group Alpha (HotAC Imperial A.I.), Bill Waller (Campaign Book and Mission Pack Layout), Justin Gan (Elite Pilot Cards and Player Record Cards Layout), and Dovi Anderson (additional Pilot Ability Cards). The new AI contains a "scratch built" xwing_ships3.js file, extensively modified html and xwing_ai3.js files, and added a number of new images. The new
HotAC AI is a faithful representation of the 2.07.04 Imperial AI cards developed by Claes Sorrenson and the Alpha Flight Group for HotAC 2nd Edition, and is a signifcant step up from AI1 or AI2. However iot contains AI for only the eight Empire ships used in HotAC. Changes were made to the html files for 1st and 2nd edition to fix some broken icons and to allow for switching back and forth between HotAC AI and AI1/AI2. No changes were made to the AI1 or AI2 javascript files. Additions were made to the style sheet, but no older styles were altered. 

6/18/2020  1.14.01/2.0.2/3.1.0 (Tomcattwo) Appended an additional 19 ships (8 Rebel, 9 Scum, 2 First Order) to incorporate AI for Flight Group Alpha Imperial Cooperative Campaign to HotAC AI
Completely updated the xwing_ai3.js and xwing_ships3.js files with many changes and new subroutines, and actions. (e.g., added a reroll function, etc.), made links changes to the .html files and minor additions the the style sheet, updated the help and info html files.
Added Flee Tables for each ship. This is a faithful representation of Claes' AI version 7.1 for all 27 ships used in both campaigns, with exception of correction of some maneuver areas in the original AI.
Changes were made to the AI2 xwing_ships2.js javascript file to correct several errors I caught in there on maneuvers while double-checking the new AI. No changes were made to AI 1 or xwing_ai2.js. Additions were made to the style sheet, but no older styles were altered.

6/21/2020 1.14.01/2.0.2/3.1.1 (Tomcattwo) Corrections to maneuver tables prior to publishing based on review and recommendations for improvement by Hipsu (Thank You!!). Also added reroll capability for Flee Hyperspace Maneuvers, a "blink" function when you click on a sector
to let you know it accepted the click (especially useful for tablet users) and a mini ship-image appears in the sector the user clicks on (tie fighters for rebels, scum and FO AI, x-wings for Empire AI.

6/23/2020 1.14.01/2.0.2/3.1.2 (Tomcattwo) "Blink" process didn't work properly for mobiles (tablets and phones); devised a new process to make it work properly. At Hipsu's request, eliminated the green "Bullseye" overlay on all FGA_image_maps.
Added functionality to prevent context menu (right click or long press on mobiles) from popping up on main page. This was a problem when pressing too long on a sector on mobile devices
Fixed xwing_ai.js to correct issue of capitalizing target sector filenames for images done during ai2 development. Restores ai1 functionality.
Added a thank you note to Hipsu (Miikka Sohlman) on info3.htm page and in this README.txt file
Changed label colors from teal to cyan in style.css
Files changed: index3.htm, info3.htm, style.css, xwing_ai3.js, xwing_ai.js, xwing_ships3.js (just to change the version number) and adding the new images.

6/29/2020 1.14.01/2.0.2/3.1.3 (Tomcattwo) Added Maneuver Tables for each HotAC and FGA ship on Main page and Ships page, with permission from sirjorj for use of screen grabs of the tables from http://xhud.sirjorj.com/xwing.cgi.
Files changed: xwing_ai3.js, xwing_ships3.js and adding the new maneuver table images.

7/9/2020 1.14.01/2.0.2/3.1.4 (Tomcattwo) Updated xwing_ships3.js and xwing_ai3.js for FGA AI Version 7.2. Minor changes to the readmes and help3.htm indicating AI update for FGA to version 7.2. No changes to ai 1 or 2 files.

1/3/2021 1.14.01/2.0.3/3.1.4 (Tomcattwo) Updated xwing_ai2.js, xwing_ships2.js, generate.py, ship.py, version.py, all ship .xml files and added new 2E-wave8.xml including new Wave 7 ship TIE br Brute and new Wave 8 ships (Droid Tri-Fighter, Eta-2 Actis and Nimbus-Class V-Wing). 
Rewrote generate.py and ship.py to include a NEW category of maneuver called force. So now ships can generate with simple, normal, difficult or force maneuvers.
This was to allow for this new maneuver type on the Eta-2 Actis (TRL2 and TRR2 Force maneuvers). All ship.xml files had to be updated for each ship to include an "empty" maneuver set for each <force></force> set of tags to allow compiling properly. 
xwing-ai2.js also updated to include the new force maneuvers and display them in purple in the ships table page and main AI page. Added new img files also. These changes affect 2nd Edition AI ONLY!!
No changes were made to HOTAC/FGA or 1E AI.

2/24/2023 1.14.01/2.5.0/3.1.4 (Tomcattwo) Updated xwing_ai2.js, xwing_ships2.js, generate.py, maneuvers.py, ship.py, version.py, all html files, and added a new 2_5_Ed.xml file to add the following ships: 
	Rebel: Gauntlet Fighter, Fang Fighter
	Empire: Gauntlet Fighter
	Scum: Gauntlet Fighter, Rogue Fighter, ST-70 Assault Ship (Razor Crest), Trident-class Assault Ship
	Resistance: BTA-NR2 Y-Wing, GR75 Medium Transport Ship
	First Order: TIE/se Bomber, TIE/wi Whisper Interceptor, First Order Raider-class Cruiser
	Republic: Cloned z-95 Headhunter, Gauntlet Fighter, CR-90 Correlian Cruiser
	Seperatist: Gauntlet Fighter, Rogue Fighter, Trident-class Assault Ship
These changes affect 2nd Edition AI ONLY!!
No changes were made to HOTAC/FGA or 1E AI.

3/19/2023 1.14.01/2.2.0/3.1.4 (Tomcattwo) This is a complete revamp of second edition to update the 2nd Edition page to the "HotAC/FGA Format". Now, every ship in 2nd edition page will display the ship's name, faction, pilot example, stats, icons, maneuver table, ship attributes, and a summary of actions in each phase for the AI to take. I also did some minor fixes to the HotAC/FGA page. Files changed include:
	1) All python files to allow for automagic generation of the xwing_ships2.js2 file using the completely updated ships .xml files to include every ship through 3/19/2023 (107 total). The new generator takes care of automagically generating 10 new random maneuvers based on difficulty for each ship in all directions. This will be a huge time-saver in the future.
	2) Made many, many updates to xwing_ai2.js and a final newly generated xwing_ships2.js file, updated to support the new format.
	3) Minor updates to xwing_ai3.js and xwing_ships3.js. There is no auto-generation for the xwing_ships3.js - still done by hand.
	4) Updates to help2.htm, index2.htm, ships2.htm, and the style.css style sheet to support display of the new 2nd Edition format.
No changes were made to 1E AI.

3/23/2023 1.14/2.2.1/3.1.5 (Tomcattwo) This update adds a user-requested "User Hotlist" functionality to 2/2.5Ed and HOTAC/FGA, and (for 2/2.5Ed only) adds the required attack die roll for Decloaking for the "Cloaking Device" upgrade to see if decloaking is required in the Planning phase for ships equipped with this upgrade. Files changed include:
	1) xwing_ai2.js, xwing_ai3.js, xwing_ships2.js, xwing_ships3.js
	2) Ship generation .xml files 2E-wave9-12.xml, huge.xml, ships.xml, wave9.xml
	3) HTML files help2.htm, help3.htm, index2.htm, index3.htm, info2.htm, info3.htm, README.txt, style.css
The Hotlist function uses sessionStorage to store user HOTLIST array information in the web browser during a user session to keep it persistent across page refreshes. The storage is deleted if the browser tab where x-wing-ai.com is running is closed or if the browser is closed.
No changes were made to 1E AI.

4/6/2023 1.14/2.2.2/3.1.6 (Tomcattwo) This update includes all the changes made to update HotAC to version 2.07.0.5 and FGA AI to version 7.3. I found many mistakes in the HotAC AI Statcards, but the FGA 7.3 update looks really good, so I used the FGA AI in preference. Most changes were made to support the updated AI, and I also added new ships: TIE/sk Striker, TIE Reaper, Gozanti Class Cruiser (Imp), AT-AT, AT-ST walkers (for the Ground Expansion) and the T-47 Airspeeder to the HotAC/FGA page. I also added an E-Wing Rebel AI (based on my 2.0/2.5 AI) to the HotAC/FGA page. I also added "Additional Imperial AI Ships AI" (with permission) by Dovi Anderson (thanks Dovi!!), and finally, I added a system section for the use of Dovi's "HOTAC Optional AI Device Rules (Beta) (with permission) for all ships capable of dropping/launching devices of any sort (Bombs, Mines, Charges, Remotes, including Illicit drops of Spare Parts/Loose Cargo/Cargo Drift).
Also fixed that add/remove ships to/from Hotlist was not working for some touch devices, by adding long-press functions to allow for Hotlist add/remove for touch devices. Files changed include:
	1) xwing_ai2.js, xwing_ai3.js, xwing_ships2.js, xwing_ships3.js
	2) Added a number of new img files to support the newly added ships, Optional Device Rules, and improve graphics quality
	3) All htm files were updated to switch the location of the logos and add updated links for HotAC and FGA downloads and HotAC Facebook site. Index3.htm, Ships3.htm and style.css files were updated to support Optional Rules for Devices.
	4) Updated version.py, generate.py and wave13_14.xml for some minor corrections in 2.0/2.5
No changes were made to 1E AI.

7/03/2024 1.14/2.2.3/3.15 (Tomcattwo) This update adds the BTA-NR2 Y-Wing to 2/2.5Ed only. The 04/06/2023 update mistakenly did not include the BTA-NR2 Y-Wing. Files changed include:
	1) xwing_ai2.js, xwing_ships2.js
	2) Ship generation .xml files: 2E-wave9-12.xml, generate.py, version.py
	3) README.txt
These changes affect 2nd Edition AI ONLY!!
No changes were made to 1E AI or HOTAC/FGA AI.
	
-------
Contact
-------
1st Edition AI:
Email: rberrett4@gmail.com
BoardGameGeek: wyzbang
Source: https://github.com/Wyzbang/xwing_ai


2nd Edition Update and HotAC AI 2nd Edition:
Email: colt.coltrain@gmail.com
BoardGameGeek: Tomcattwo
Source: https://github.com/Tomcattwo/xwing_ai2

----------
Dedication
----------

The 2nd Edition AI, Combined fileset, and HotAC+FGA AI work is dedicated to the memory of my stepson, Chris Glidden,a devoted Star Wars fan and X-Wing player, who lost his year-long fight with pancreatic cancer on February 9, 2019. Chris was a Jedi Knight, right to the very end. May the Force always be with you, son.

-------
Credits
-------

Game Web Site:  http://www.fantasyflightgames.com/edge_minisite.asp?eidm=174


--------------
Special Thanks
--------------
Many thanks to Hipsu (Miikka Sohlman) for playtesting the HotAC+FGA web app and making great suggestions for improving it.
Heores of the Aturi Cluster Rebel Cooperative Campaign Game authors: original by Josh Derkson, updated to 2nd Edition by Shaun Tiernan
and the HotAC 2nd Edition Team:
Imperial A.I. courtesy of Flight Group Alpha and Claes Sorennson
Campaign Book and Mission Pack Layout courtesy of Bill Waller
Elite Pilot Cards and Player Record Cards Layout courtesy of Justin Gan
Playtesting by Recon Specialists - Patrick Patrick and Padre
Additional Pilot Ability Cards by Dovi Anderson

Flight Group Alpha - an Imperial Cooperative Campaign by Claes Sorrenson and Flight Group Alpha - OUTSTANDING work! 
A superb Imperial campaign game that takes you through the experience of the 1990's 'TIE Fighter' computer game by LucasArts (I LOVED that game!!)

Ralph Berrett for years of work on the original X-Wing_AI code, and for making it so easy to modify, and for sharing it with the world for free.

SirJorj for developing all of the 1st and 2nd edition X-Wing Miniatures game ships, maneuvers, pilots and actions at http://xhud.sirjorj.com/xwing.cgi

Andrzej Sieradzki, who created the original AI algorithms (http://boardgamegeek.com/filepage/83094/x-wing-solo-system-tie-fighter)

SeraphTC for the HWK-290 and Z95-Headhunnter images (http://boardgamegeek.com/user/SeraphTC)

reverend Uncle Bastard for the new target ring images (http://boardgamegeek.com/user/reverendunclebastard)

Spark for the Stressed Maneuver and using the Action Icons idea.
