GithubHelp home page GithubHelp logo

cgol's People

Contributors

tiller-tolbus avatar rabsef-bicrym avatar

Stargazers

~litlep-nibbyt avatar

cgol's Issues

sail: `/app/cgol/play/hoon` completion

TODO:

  • I can specify the number of cycles I'd like to perform and hit play
  • I see my display update and count down with a n second timer between phases
  • I have a cancel button I can press
  • URL parameter play with a value of on causes us to continue playing
  • A counter counts down how many remaining frames I have
  • A step counter counts up for my game
  • I can click save and save the state of my game to state
  • I can click make to make a new board
  • I can click the checkboxes and interact, the reading of which changes to the state of my board
  • I can click load and I'm taken to /game/hoon

cgol: binary, expansive engine

Current RLE -> @ub conversion routine:

::  +brun: binary from run
::
++  brun
  ^-  $-([rows @ud] bin)
  |=  [ran=rows x=@ud]
  =|  bun=@ub
  |-
  ?~  ran  bun
  ?@  i.ran
    ::  on newline, pad the row
    =?    bun
        !=(0 (mod (met 0 bun) x))
      (rsh 0^(mod (met 0 bun) x) bun)
    $(ran t.ran)
  %=    $
    ran  t.ran
  ::
      bun  
    (cat 0 (fil 0 +.i.ran ?-(-.i.ran %live 0b1, %dead 0b0)) bun)
  ==

Write an engine that can take, e.g., the classic blinker 3o (0b111) and compute its movement on a stage that is programmatically large enough to encompass any movement (i.e., in this case, 5x5 grid to show all movement and all possible, relevant neighbors to live cells) using only hoon's bit arithmetic and logic functions.

The ultimate goal here is to write a flexible, binary engine for cgol that expands to form a square board to encompass all possible live cells produced by some initial seed formation.

See run length encoding, this

cgol: `ngen` `$-([game @ud] game)` where `game` is modified `@ud` steps

++  ngen
  |%
  +$  stat  [ole=board nel=(list ?) [x=@ud y=@ud]]
  ++  play
    ^-  $-([game @ud] game)
    |=  [gam=game n=@ud]
    |^  ^-  game
      |-  ?:  =(0 n)  [%0 size.gam step.gam bord.gam]
      $(bord.gam (next bord.gam), n (dec n), step.gam +(step.gam))
    ++  next
      |=  bord=board
      =;  [neu=board sta=stat]
        neu
      %^    spin
          bord
        [ole=bord nel=*(list ?) [x=*@ud y=*@ud]]
      |=  [cur=(list ?) stat]
      |-
      ?~  cur  [`(list ?)`(flop nel) [ole ~ [0 +(y)]]]
      =+  fren=(friends x y ole)
      ?:  ?=(%.y i.cur)
        ?:  (lth fren 2)  $(cur t.cur, x +(x), nel [%| nel])                    ::  overexposed
        ?:  (gth fren 3)  $(cur t.cur, x +(x), nel [%| nel])                    ::  overcrowded
        $(cur t.cur, x +(x), nel [%& nel])                                      ::  goldilocks!
      ?:  =(3 fren)  $(cur t.cur, x +(x), nel [%& nel])                         ::  necromancy!
      $(cur t.cur, x +(x), nel [%| nel])
    ++  friends
      |=  [x=@ud y=@ud ole=board]
      =+  max-y=(dec y.size.gam)
      =+  max-x=(dec x.size.gam)
      ;:  add
        ?:(|(=(0 x) =(0 y)) 0 !(snag (dec x) (snag (dec y) ole)))               ::  up-left
        ?:(=(0 y) 0 !(snag x (snag (dec y) ole)))                               ::  up
        ?:(|(=(0 y) =(max-x x)) 0 !(snag +(x) (snag (dec y) ole)))              ::  up-right
        ?:(=(0 x) 0 !(snag (dec x) (snag y ole)))                               ::  left
        :: 0                                                                    ::  me
        ?:(=(max-x x) 0 !(snag +(x) (snag y ole)))                              ::  right
        ?:(|(=(0 x) =(max-y y)) 0 !(snag (dec x) (snag +(y) ole)))              ::  down-left
        ?:(=(max-y y) 0 !(snag x (snag +(y) ole)))                              ::  down
        ?:(|(=(max-y y) =(max-x x)) 0 !(snag +(x) (snag +(y) ole)))             ::  down-bad
      ==
    --
  --

sail: `/app/cgol/game/hoon` completion

User Stories:

  1. I can see my saved games by ID and maybe their RLE encoded run.
  2. I can click load next to a game and be sent to ../play/hoon with that game loaded
  3. STRETCH: Integrate #1

/play/hoon api: URL parameter game = @uv of game you wish to load.

cgol: `(list (list ?))` -> `bitmap` library

cgol stores active game sessions as a game, below:

+$  game
  $:  %0
      size=[x=@ud y=@ud]
      step=@ud
      bord=board
  ==

Where a board is a (list (list ?)). This format affords us easy conversion to a bitmap image for mini-map views for selecting saved games.

Please write an arm in /lib/cgol/play/hoon $-((list (list ?)) bmp) where bmp is encoded such that it can be directly inserted into a sail page img tag as src.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.