Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Efficient implementation of Langton's Ant cellular automata on an infinite grid for cooperative highway search

License

NotificationsYou must be signed in to change notification settings

MrCamoga/Langton-s-Ant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multicolor extension of Langton's Ant cellular automaton that finds highways and their periods

It supports square and hexagonal grid, 3D and 4D

Moves supported by each mode:

  • Square: R, L
  • Hexagonal: F, R, r, B, l, L
  • 3D: R, L, U, D
  • 4D: R, L, U, D, X, Y (90º and -90º rotations along xy, xz and xw planes)

More information onWikipedia

How to use

You first have to registerhere. After that, go to settings and generate a secret token to login on the java client. The token can be regenerated again if it's lost.

Commands

  • -wn: Runsn ants simultaneously on different threads (limited to the number of CPU threads)
  • -whn: Runsn hexagonal ants simultaneously on different threads (limited to the number of CPU threads)
  • -w3n: Runsn 3D ants simultaneously on different threads (limited to the number of CPU threads)
  • -w4n:Runsn 4D ants simultaneously on different threads (limited to the number of CPU threads)
  • -uusername: Login asusername, you have to enter the password on the next line
  • --nogui: No interface mode
  • --nolog: No log mode

Example:

java -jar langton.jar -w 4 -wh 2 --nogui

How it works

The server sends rules to each client to check if they form a highway and if so, find their period, size and the ant rotation.

Every few minutes, the client sends the data back to the server and stores the rules in the database.

This way we make sure that no rule is tested multiple times.

TODO

  • Server
    • Verify rules by different clients (WIP)
    • Improved client-server protocol.
  • Webpage
    • Simulator (2d, hex, 3d, 4d,...), step by step, change map size, save image or video,...
    • Search highways on database
    • Login/Register
    • Like rules
    • User statistics and profiles
    • API
    • Add new winding data to database
    • Add histogram of the states used in the highway construction?
    • User lists to save rules (WIP)
    • Comments on rules (WIP)
    • Translation to other languages (WIP)
  • Improve GUI
  • Refactor code
  • Different work types:
    • Approximate period of big highways
    • Find exact period of big highways
  • Render hexagonal grid
  • Parallel computing on GPU (doesn't seem possible)
  • Compute approximate period of highways on the fly
  • Algorithm to differentiate triangles/squares from highways:
  • Calculate size of highways (displacement of the ant each period, e.g. the displacement of the original ant is 2x2). This is useful to distinguish highways with the same period but different structure.
  • Calculate ant rotation (accumulated rotation of the ant to further distinguish ants with same period and size).
  • Make period calculation work 100% of the time in O(n). Right now the period calculation breaks on 0.1% of the rules but at least it says they have period 1 so they can be retested in the future.

Database

Go toLangton's Ant Rule DB to explore the database.

Biggest highways with unknown period

If we find the size of the highway and the velocity at which it advances, we can estimate the total period of some huge highways (supposing the ant in fact forms a highway and doesn't break midway). To get the size of the highway, we find the period of each line of cells and compute the least common multiple of all of them. For the velocity, we iterate the ant and note approximately how many iterations it takes the ant to advance one cell in the direction the highway is growing.

Tested to # itersRule StringRule numberHighway sizeEstimated periodReal periodRel. Error
4.7e11LLRLRRRLRRLLLRRLLLLLLRLLRLRR220226420> 2^500??3e154
1e11LLRLRRLLRLLLLLLRRLLLR1147188>= 133671045600>=1.104122836656e15
1.1e13RRLRLLRRLRRRRRRRRRLLLRLLRLR86245067>= 4707316320>=4.18492189e13
1e13RRRLRRLLRLRRRRLLRRRLLRLR109601832^42*3 ??3.77616273e16 ??
4e11LLRLRRLLRLLLLLLLLRRRRRRLRLR92143924>= 886624056>=5.730524292850e12
7.6e11LLRLRRLLRLLLLLLLLLLRLRLR11010356>= 146880
1.4e12LLRLRRLLRLLLLLLLLRRRLLRLR21889332>= 1573560
1.5e10RRLRLLRRLRRRRRRRRRLRRLRLRR56360651>= 2364582528
15004911
96534219
5470519604
10369105611
16241131211>= 65597220
25065946827
26106134219
28052291275
34763177675
1.74e12RRRLRRLLRLRRRRRRRRRLR15721512^40*3 ??5.64742157e155647091720257856?0.00584%
LLRLRRLLRLLLLLLLLLLLRRLRLR45089076314605202027403998262006310774041.05%
5772148427283015202422943381242418360275560.189%
120192715345430803184763752543178692165520.191%
RRLRLLRRLRRRRRRRRRLRLLLLLR34340555478474920340626295548034090345587080.081%
RRLRLLRRLRRRRRRRRRLLLLRLRR54787787777109320652424460934065187898128880.083%

[8]ページ先頭

©2009-2025 Movatter.jp