Aven Games

Programming Projects by a UAF CS and Math Student

Neural Network Cryptography

I recently read this paper and decided to try an implementation.  I love neural networks and cryptography so this concept is probably one of my favorite things ever.  With around 4-5 hours of work into the project I haven’t seen very promising results with any of the parameters I tried.  Either the nets do not synchronize fast enough to be usable or an attacking net can quite easily synchronize.  You can check out the simulation code, stats and my future work on the project on github.

“Ride the Bus”

I recently encountered the game “ride the bus,” and the rules and statistics to the game interested me so I decided to run a simulation of it.

– Played with a standard 52 card deck.
– 7 cards are drawn and lined up.
– First card is revealed.
– Player must guess whether the next card will be higher or lower.
– If the player guesses wrong the cards are reset and they must drink.
– Victory occurs when the player guesses all six cards (after the first) correctly.

Now the game also has a preliminary stage where players try to remove cards from their hand by giving or taking drinks based on the round.  The player with the most cards would then have to play “ride the bus” with the above rules.  I wondered how many drinks it was reasonable to take before one might as well risk riding the bus.

Turns out, if you are going to have to take more than 4 drinks to avoid “riding the bus”, just take your chances.  You can see the code on github here.


Rounds: 100000
Average: 4.19836 drinks
Standard Deviation: 4.69325 drinks


Drinks: 0 Rounds: 19323 Prob: 0.19323
Drinks: 1 Rounds: 15785 Prob: 0.15785
Drinks: 2 Rounds: 12459 Prob: 0.12459
Drinks: 3 Rounds: 9946 Prob: 0.09946
Drinks: 4 Rounds: 8173 Prob: 0.08173
Drinks: 5 Rounds: 6518 Prob: 0.06518
Drinks: 6 Rounds: 5285 Prob: 0.05285
Drinks: 7 Rounds: 4324 Prob: 0.04324
Drinks: 8 Rounds: 3543 Prob: 0.03543
Drinks: 9 Rounds: 2840 Prob: 0.0284
Drinks: 10 Rounds: 2287 Prob: 0.02287
Drinks: 11 Rounds: 1776 Prob: 0.01776
Drinks: 12 Rounds: 1478 Prob: 0.01478
Drinks: 13 Rounds: 1182 Prob: 0.01182
Drinks: 14 Rounds: 994 Prob: 0.00994
Drinks: 15 Rounds: 814 Prob: 0.00814
Drinks: 16 Rounds: 605 Prob: 0.00605
Drinks: 17 Rounds: 490 Prob: 0.0049
Drinks: 18 Rounds: 400 Prob: 0.004
Drinks: 19 Rounds: 333 Prob: 0.00333
Drinks: 20 Rounds: 259 Prob: 0.00259
Drinks: 21 Rounds: 205 Prob: 0.00205
Drinks: 22 Rounds: 204 Prob: 0.00204
Drinks: 23 Rounds: 162 Prob: 0.00162
Drinks: 24 Rounds: 124 Prob: 0.00124
Drinks: 25 Rounds: 95 Prob: 0.00095
Drinks: 26 Rounds: 87 Prob: 0.00087
Drinks: 27 Rounds: 70 Prob: 0.0007
Drinks: 28 Rounds: 57 Prob: 0.00057
Drinks: 29 Rounds: 30 Prob: 0.0003
Drinks: 30 Rounds: 21 Prob: 0.00021
Drinks: 31 Rounds: 20 Prob: 0.0002
Drinks: 32 Rounds: 20 Prob: 0.0002
Drinks: 33 Rounds: 19 Prob: 0.00019
Drinks: 34 Rounds: 13 Prob: 0.00013
Drinks: 35 Rounds: 6 Prob: 6e-05
Drinks: 36 Rounds: 13 Prob: 0.00013
Drinks: 37 Rounds: 7 Prob: 7e-05
Drinks: 38 Rounds: 8 Prob: 8e-05
Drinks: 39 Rounds: 7 Prob: 7e-05
Drinks: 40 Rounds: 1 Prob: 1e-05
Drinks: 41 Rounds: 1 Prob: 1e-05
Drinks: 42 Rounds: 2 Prob: 2e-05
Drinks: 43 Rounds: 4 Prob: 4e-05
Drinks: 44 Rounds: 2 Prob: 2e-05
Drinks: 45 Rounds: 2 Prob: 2e-05
Drinks: 46 Rounds: 3 Prob: 3e-05
Drinks: 48 Rounds: 1 Prob: 1e-05
Drinks: 59 Rounds: 2 Prob: 2e-05

Chat/game websocket server framework

I have spent a lot of time looking for a good asynchronous python websocket framework to use and I finally found it.  Autobahn is exactly what I have been looking for.  It is high performance, low memory, asynchronous and allows for easy communication between connected users via the self.factory construction.  I used the broadcast example as a basis for my server created a simple chat server.  Hopefully will be done with the social system and start work on the game server.

Website, chat server and game progress

The krynth.com website is still constantly being reworked, but I am pretty happy with the overall layout it has at this point.  The login, registration, and account verification systems are all done and currently running on the site.  I have a development version of the chat server running, but I am still having memory leak issues with closing connection threads.  I realize everything is very vauge and unhelpful, but I will post my code and documentation once I get things cleaned up and a bit more secure.  Since the chat server is close to done, the game server should be a few simple modifications away.  After that everything should be set to go!

Krynth Site Design

I have purchased a VPS server and have it set up with Apache httpd as the webserver, mySQL as the database, and python with the Flask framework for server side scripting.  I went through the process of learning SQLAlchemy and the corresponding Flask-SQLAlchemy extension, so I have the framework in place for an amazing website/game.  As I learn Jinja templating to do my site appearance, I decided to sketch out my ultimate plans for the site, so I have something to go off of as I work.  Here is the plan:

Krynth site design

Krynth Progress

I finally sat down and did some actual work this past weekend.  What I currently have working is a WebGL application drawing a board of tiles.  The square tiles can have each of the 4 sides be open or closed, and can be rotated.  The rows and columns of the board can slide up or down, and the free tile is inserted and updated with the newly kicked out tile.  What still needs to be done is the game implementation, animating the free tile movement and tile sliding and finally multiplayer.  Here is a screenshot of my 4-5 hours of work:


Simple game server structure

  • Server listens on a port
  • Users send tcp message containing user login info
  • looks up user’s matchmaking info/verify’s user’s info
  • If everything is good, adds user to matchmaking pool
  • algorithm matches players based on how close they are in MMR as well as how long they have been waiting.
  • When players have been matched server spawns a thread to relay their match messages.
  • Once match is complete the thread terminates, adjusts each player’s MMR accordingly and reports the results to clients

Must be VERY simple to conserve as much memory as possible.  We shall see how many players I can handle on the 2GB memory on my VPS.

Will probably have to do some work to try and secure this system (make sure account info is not plain text in both packets and storage, etc…).