Basically, instead of having a big list of "if ____, then ____" commands, you simplify it into a limited number of "states"
For the fish it was "swimming", "turning", and "idle" and just cycled between the states, making the fish do certain behaviors in each one. I'll do something similar with the mouse in this. "free", "unit selected", "attacking", "moving" or something along those lines.
...that's probably a decent cue to reply to the following:
My idea was, a pack of wolves hunting.
making them behave naturally while also on a grid is not something I know how to do.
I had no idea where to start, so I sort of drifted off on that problem, and moved to easier to make stuff/stuff i already knew the basics of.
Briefly
edit: <= That word turns out to be a blatant lie... Sorry!, I have done something like this (not wolves, but it can be generalised to all kind of things, that you want to 'zerg' in anything more than a dumb rush at a target and exhibit other behaviours.
It'd be a dynamically (and cross-referencing) weighted sum of urges that I'll call Pack, Prey and Personal.
Pack is perhaps the most complicated, but based around Swarming behaviour where the desire is to be not too distant (but not necessarily too close) to other pack-members. it might have sub-states (for wolves: travelling mode, hunting mode, running-down mode, going in for the kill) which might designate a desired position to be at a given the flank of the pack 'mass' (or even gone around what is in front, info from the Prey urge's targetting, to lie in weight as a backstop to the more obvious zerg-like rush, which necessitates a special "pack position attractor/repulsor" combination to guide its individual swarming bevaviour), if not the Alpha position who merely feels the need to follow The Plan, so long as they have the flanks near them that they think they should have. - There's simpler versions of this, but you can have fun tuning the more exotic tactics into it to. The urge to Pack might be strongest (given more weight) in both offensive and defensive situations, but if (say) sufficient pack-members (or the Alpha, in particular) are lost/unseen during an encounter with an antiPrey (see below), it could be suddenly revalued as the weakest weighting of urge.
The urge of Prey is a (usually attractive) tendency to head for a target. If not
actual prey (the current thing being hunted, or a scavangable item of interest), it can be something off-screen (the pack's den, where there is a desire to rest and recuperate?). It can also be a negative urge (encountering a dangerous foe, "antiPrey", the urge is to go
away from that spot, being liable to become prey oneself) and there's the "healthy distance" version which encourages a Pack/Flock-like distance from the target (close in, to surround a big bovine wielder of sharp horns and worry at it but keeping out of range of its head-weapons; further away, such as cautiously moving beyond the herd (undetected) to spring a divisive pincer attack...). Plus there can be (and often will be) multiple such Prey (and/or antiPrey) point presences to sum up the effects from. Strengthened and weakened in the global mish-mash of primary Urges according to various factors.
The element of Personal is the random-wander, the strength of desire to be closer to the (potential) food than the others, the expectation that one is always at the right flank of the Alpha (the pack pecking-order generator having assigned this position, or another, to this particular individual) or near/further from another pack-friend/-rival. Usually the most subtle effect that just makes the rest of the behaviour not look like it's being coordinated by a computer (though it is!), but could be dominant if (say) you encounter the wolfpack when idling, and you're stealthed to the max and just creeping through the area.
Just take the three major Urges (themselves a summation of sub-Urges under their own rules and sub-states and all those pesky little calculations that generally boil down to vectors of various kinds) and, depending upon the State (could be merely Hungry, Fearful, Idle or a bit more complicated) mix them together for each wolf, translate that to a movement, enact those movements, deal with reactions (others in the pack, other NPC entities involved, the player's response in their own 'tick') and perhaps change state (packwide or personal) if circumstances changed across a threshold of any kind
And you can isolate and test each Urge (and sub-Urge) in its own right, before then testing States that define the mix. Can't promise you no unexpected emergent behavious (e.g. a tendency for the pack to spiral clockwise around some strange and otherwise unremarkable point - easily done!), but you can make sure that your vector-maths doesn't make them a direct result of some basic wrong-sign-error in an initial subcomponent.
The trickiest thing is the grid aspect. With directions (instantaneous, per tick, at least) being restricted to cardinal/diagonal and 'speeds' being probably one tile (or ✓2 tile-edge distances, but diagonally) at a time, subtleties might be lost. Collisions (movement to same tile) need thinking about (DF solution? Or does one entity (randomly?) get there first and block the other entity(/ies) that wished to move there?), as does the finer-angles of destination perhaps need some stateful 'memory'[1] All problems avoided in a vectorised movement system with a positional resolution much finer than the 'station-keeping' distances that you'd not normally expect your entities to approach within (except for deliberate collision/attack).
But it also needn't be this complicated. It could just he Pack
or Prey
or Personal (i.e. "Idle) for general station-kept movement across the map, surrounding (or fleeing directly away from) the biggest attractor (or repulsor) or the generally lolling about with occasional shuffling around at random. Depending upon the wolves'
single current (shared) State. You don't need to combine them proprtionally, necessarily, and might even have some other mutually-exclusive states (P-initialed or otherwise...) that you think they should do. Like circling an apparently uninteresting point. (Perhaps indicating wary interest in something that the player can't immediately see? But if you disturb/displace/kill the pack and get go examine the focus tile properly you end up finding that some Mystical Orb Of Power was half buried there, and it's a very useful loot-item with geat in-game potential!)
Then again, I
do like Emergent Behaviours from a tuned (or improperly tuned!) mix of simulated wants, needs, fears and whims. If only I could progress to making some of my thought experiments reach consumer-grade levels of quality, rather than moving onto
my next (mostly unrelated) whim.

[1] If, for several turns, you're highly consistently attracted to go 8 tiles north and 7 tiles northwest of your initial position, better to aim to alternate N, NW, N, ... (terrain/obstacles allowing) than clump Ns until the dominant direction is now NW and then potentially clump
them. Additionally, if it's an 'off-map' attractor, N should not win out every time just because
at each step the vector is 8xN and 7xNW as it wants to head at roughly the same angle to a point off 'at infinity'. Some stack of recent compromises in movement that skews in a NW because "we've already oversubscribed on the Norths, at this time!" could be a useful trick, even to bias a
recalculated Urge-vector, to indicate some sort of Urge-inertia, in that tracking slightly NNW wins out for a tick or two, even when N now is twice as necessary as NW, say.