1. 22 Dec, 2011 1 commit
  2. 20 Dec, 2011 2 commits
    • Sam Moore's avatar
      Added new sample AI - "vixen", improved "basic_python" · 72df4ec1
      Sam Moore authored
      I was going to create a highly advanced super AI and not reveal the source code. Then I would win the competition!
      But, turns out it is just as shit as all the others, so I added it to git. Also I made the competition, so that seems fairly self defeating.
      
      It was easier to add some extra stuff to basic_python than to force it into the new AI.
      
      "vixen" (where do I get these names? Well, a fox is smart, and a vixen is a fox. Therefore, "vixen" is a smart AI. Q.E.D)
      
      I basically copied asmodeus' "optimised score" and path finding technique, but I changed the way scores are calculated to include probability.
      At one point I was adding the scores for paths that began with the same direction. This seemed like a brilliant idea. It was not.
      
      After all this, vixen beats asmodeus some of the time, I haven't tested how often, but each AI has beaten the other at least a few times.
      Most of the time vixen loses seems to be due to losing the marshal or general on bombs. Its pretty good at countering the spy.
      
      It turns out writing a decent stratego AI is harder than I thought :P
      
      In other news, in the manager program, I removed the automatic hiding of the AI's pieces when a human is playing, because its useless and annoying.
      72df4ec1
    • Sam Moore's avatar
      Added new sample AI - "vixen" · 3d01a564
      Sam Moore authored
      I was going to create a highly advanced super AI and not reveal the source code. Then I would win the competition!
      But, turns out it is just as shit as all the others, so I added it to git. Also I made the competition, so that seems fairly self defeating.
      
      "vixen" (where do I get these names? Well, a fox is smart, and a vixen is a fox. Therefore, "vixen" is a smart AI. Q.E.D)
      
      I basically copied asmodeus' "optimised score" and path finding technique, but I changed the way scores are calculated to include probability.
      At one point I was adding the scores for paths that began with the same direction. This seemed like a brilliant idea. It was not.
      
      After all this, vixen beats asmodeus some of the time, I haven't tested how often, but each AI has beaten the other at least a few times.
      Most of the time vixen loses seems to be due to losing the marshal or general on bombs. Its pretty good at countering the spy.
      
      It turns out writing a decent stratego AI is harder than I thought :P
      
      In other news, in the manager program, I removed the automatic hiding of the AI's pieces when a human is playing, because its useless and annoying.
      3d01a564
  3. 11 Dec, 2011 1 commit
    • Sam Moore's avatar
      Fixed bugs, minor changes · baf69b8d
      Sam Moore authored
      Fixed segfault in manager caused by attempt to print invalid setups to log
      Fixed SIGPIPE in manager caused by attempt to message non-existant programs.
      
      Although I previously fixed a similar SIGPIPE, It is also possible for a file to exist but not have executable permissions set.
      Controllers set to use such files as executables were returning true for Valid(), but were in fact, not valid at all.
      
      Use the access function (thanks stack overflow!) to check for executable permissions
      and existence in Program::Program. If they aren't set, or file doesn't exist, set
      pid to -1 which is an "invalid" controller.
      
      Discovered python trick which allows me to get rid of stupid "run.py" files for the python AIs.
      
      Modified the simulate script to take the number of rounds as an argument.
      Also made its output slightly prettier.
      
      Currently testing simulation of 10 rounds on my laptop at home.
      
      "./simulate 10; shutdown -h -P now"
      
      I hope it doesn't set the desk on fire while I'm asleep... :S
      
      Oh, and the VM is finally setup, hooray!
      baf69b8d
  4. 08 Dec, 2011 4 commits
    • Sam Moore's avatar
      The /home was not necessary · 88fc5a96
      Sam Moore authored
      Derp
      88fc5a96
    • Sam Moore's avatar
      Changed the directory structure. · e3b15cd5
      Sam Moore authored
      e3b15cd5
    • Sam Moore's avatar
      Fixed segfault in manager program · 7f7bc054
      Sam Moore authored
      Caused by the Program base class attempting to write EOF to programs
      which had already exited. This caused a SIGPIPE signal.
      
      The SIGPIPE handler function Game::HandleBrokenPipe then attempted to log the
      event by calling Game::theGame->logMessage
      
      However, since the program was exiting, DestroyGame had been called
      and Game::theGame was in the process of being deleted.
      
      Fixed by removing the fputc(output, EOF) line in Program::~Program.
      
      It is ironic that this only became an issue since I modified the sample
      AI to actually obey the protocol and exit as soon as "QUIT" is recieved...
      7f7bc054
    • Sam Moore's avatar
      Modified manager program, updated website · 17a20de4
      Sam Moore authored
      Major changes: Added simple GUI for human players
      Setup phase doesn't use GUI yet (uses a default if -g enabled).
      Click in the general region of where you want to select/move pieces.
      
      Modified Board::Draw to allow for showing of already revealed pieces,
      but not all pieces. Used to make human player GUI nicer (hides AI pieces).
      
      Modified -t switch to allow for "infinite" stall_time
      (wait for user to press enter)
      
      Changed website. Removed protocol description and linked to manual.txt.
      Added screenshot to make things slightly more exciting.
      Updated manual.txt
      
      Minor changes to simulate.py (output)
      
      TODO:
      Fix segmentation fault found in manager program
      It occurs just before exit. Memory error in the cleanup process?
      ANNOYING!
      
      Still have to bring myself to take the time to finish setting up that vm...
      Need to talk to a non-hostile wheel member about security. I don't want my vm to take out our network or something.
      
      Preferably I don't even want the vm to be compromised, regardless of the rest of ucc.
      So much I don't know about servers/linux...
      
      Need to stop staying up past midnight...
      17a20de4
  5. 07 Dec, 2011 1 commit
  6. 03 Dec, 2011 2 commits
    • Sam Moore's avatar
      More adding of pointless crap to manager · b563784f
      Sam Moore authored
      -f option to allow replaying of games output to files with -o
      -m option to enforce max number of turns (default 5000) before a DRAW is called
      -p to print a colourful representation of the board to stdout
      
      Yes. I now have both graphics AND pretty coloured terminal escape codes.
      Why did I do this??????????????
      b563784f
    • Sam Moore's avatar
      Revamped manager program and added manual page · 4a3c0478
      Sam Moore authored
      Seperated controllers into AI and human controllers, which inherit from the same base class
      Using "human" as an argument instead of an AI program will allow human player. However, the human player has to use the CLI.
      
      I have tried playing a few games, and it is incredibly annoying using the CLI (especially when each turn was printed to stdout - now suppressed).
      Usually I accidentally enter the wrong coordinates, or spend 30 seconds trying to work out the coordinates of a piece.
      Then when I switch the focus, the SDL window goes blank, and I don't know what the hell is going on.
      In conclusion: Should probably add GUI for human players!
      
      Created Game class to manage playing the game, rather than hacking everything into main.cpp
      Added argument switches for timeouts, graphics, output file, help, allowing illegal moves, revealing colours etc
      Added result lines (output who actually wins... amazing!) The massive spamming output that used to be printed is suppressed (enable with -o stdout/file).
      
      Created manual.txt which is the manual page for stratego (the manager program).
      stratego --help will display the page (using "less" - should probably fix for systems without "less").
      
      Changed tokens used for pieces from alphabet characters to digits for the ranked pieces, 's' for the Spy, 'B' for Bombs and 'F' for the Flag.
      This makes things clearer. The Spy would be "10", except thats 2 characters, which is a bit awkward!
      Didn't change the order of the enum, because thats just asking for trouble and besides, it works.
      Changed stratego to output the characters for the piece, instead of an integer rank (except for Flag, Bomb and Spy, no difference).
      
      Need to handle situations where a player has lost all their mobile pieces. Do they lose?
      Currently they will be forced to make an illegal move, and the other player wins by "default".
      
      Found mistake in forfax move score calculation that lead to moves having negative scores,
      and hence occasionally an illegal move would be chosen as more valuable than legal moves.
      Probably fixed. Illegal moves now score -1, so should NEVER be made! Ironically the change seemed to decrease forfax's performance against dummy.
      Forfax still seems to make really stupid moves, and I can't see why. Occasionally it does something smart
      (attacks Marshal with Spy just after the Marshal reveals itself), but I'm not sure how often these are coincidences.
      Even with the devaluing of moves that don't end in combat, Forfax still gets into long cycles of repeated paths with no purpose.
      And Forfax NEVER attacks Bombs or the Flag... even if thats all the enemy has, and even if the attacking piece would be a miner.
      
      Updated web page. Considering replacing Protocol Description as is with that written for manual.txt, which I feel is clearer.
      
      Need to make next git commit message shorter...
      4a3c0478