FishTank.jl

FishTank.jl creates an e-fish for you in case you feel lonely when you are coding.
Author akjake616
Popularity
4 Stars
Updated Last
2 Months Ago
Started In
June 2024

FishTank.jl

Build Status

FishTank.jl creates an e-fish for you in case you feel lonely when you are coding ๐ŸŸ. The game is visualized using PlotlyJS.jl and PlotlyGeometries.jl.

FishTank.jl

Features

  • Customized Fish Tank: Set up your unique fish tank environment ๐Ÿ’ฅ
  • Interactive Fish Feeding: Add fish feed and wait for your fish to eat them up โ™ฆ๏ธ
  • Realistic Fish Behavior: Fish can sleep occasionally, mimicking natural behavior ๐Ÿ’ค
  • Decorate with Water Plants: Enhance the tank with water plants for a more vibrant look ๐ŸŒฑ
  • Random Landscape: Landscape created with a random Gaussian surface (using FFTW.jl under GPL license โ—)

Installation

To install FishTank.jl, use the following command in the Julia REPL:

using Pkg
Pkg.add("FishTank")

Usage

In order to start a fish tank, you simply need to use the package and call the init() function.

using FishTank
init() # creates a random colored fish by default.

To feed the fish with, for example, six grains, call the following:

feed(6) # add 6 grains to the fish tank, if the input is not specified, 10 grains are added

To decorate the fish tank with waterweed:

plant() # randomly plant one waterweed bunble

You can also set the az/el view angle by

look(0, 10) # az = 0 deg, el = 10 deg

or even do some animations:

@async for n in 1:360
    look(n, 0)
    sleep(0.1)
end

Enjoy! ๐Ÿ‘ผ

APIs

The following APIs are used to interact with the fish.


init(color::String)

Initialization of the fish and tank. The fish is specified with the color=color. If color is not specified, the color of the fish is set to be random. Currently only one fish tank can be initialized per process.


pause()

Pause simulation. If you want to rotate the tank (for a different view), one should pause the simulation first. I have no better solution for this (rotating the plot and continuing the simulation at the same time), so feel free to contribute if you know how to solve this issue ๐Ÿ˜˜


go()

Continue simulation.


mute()

Turn off sound effects. The default is on.


unmute()

Turn on sound effects.


feed(n::Int=10)

Add n grains (add 10 if n not specified).


check()

Check the number of grains.


plant()

Plant waterweed.


replot()

Replot the fish tank window (if it is accidentally closed).


look(az::Real, el::Real)

Set the az/el view angle. A word on the view: currently in order to solve memory usage issues, I have to purge the plot every period of time, and this resets the view angle if you rotates the plot by pause() -> iteractive rtation -> go(). It is better to set the default view angle by this function. Think of pause() and go() as some debug functionalities please ๐Ÿ˜†


Used By Packages

No packages found.