I typically keep my state in an atom, and use swap! to update it. This
means I can decouple rendering and other things from the actual game logic.
However, depending on how your application functions, you might just be
able to keep the state in a loop.

- James


On 23 June 2014 21:53, Majen Ful <[email protected]> wrote:

> Thank you all !
> @James, I confirm it is like Bang! (same editor), but I prefer this ;-)
>
> So in fact I don't have to have a state to update, instead, I just pass my
> init state to functions/loops to get a new one.
>
> Le lundi 23 juin 2014 21:54:56 UTC+2, Majen Ful a écrit :
>
>> Hello all,
>>
>> First, thank you all for your contribution and your help. I just follow
>> Clojure's news and groups, and I'm really impressed by how this community
>> is pleasant and helpful.
>>
>> Well, I am new to Clojure world, I do programming as a hobby (I'm not
>> pro) and I don't have advanced knowledges. However I really enjoy
>> programming and I like games. In a "classic" language, as Ruby or Java, I
>> can use mutable states and objects so it is "easy" to reason. In Clojure, I
>> understand how immutability works, but I still miss some reflexes.
>>
>> My goal is to build a little card game like http://boardgamegeek.com/
>> boardgame/128667/samurai-sword
>> A lot of things to do, but I have some difficulties at beginning.
>>
>> For example, I can define cards, I can define some function (isdead,
>> attack)... But how can I save the state of the game ? When a player attacks
>> another player, the second player must have its life reduced. At this
>> point, my OO reflexes are went back and don't find a solution.
>>
>> Could you give me some tips and lead me to the right things to do.
>>
>> Thanks by advance :-)
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to