Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail From: fir Newsgroups: comp.lang.c Subject: logically weird loop Date: Wed, 20 Nov 2024 16:56:56 +0100 Organization: i2pn2 (i2pn.org) Message-ID: <0e1c6d2e74d44a715bf7625ca2df022d169f878a@i2pn2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 20 Nov 2024 15:57:01 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="3369117"; mail-complaints-to="usenet@i2pn2.org"; posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0"; User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 X-Mozilla-News-Host: news://i2pn2.org:119 X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 1928 Lines: 35 i coded soem roguelike game loop which gave me a lot of logical trouble imagine game has micro turns, thise micro turns are noted by int game_time = 0; //styart with microturn 0 if you press a key on keyboard you update variable of chuman character: character[HUM}.action_end = game_time+300 then the not human bits should execute in thise microturns until you reacg turn 300 then you need to read keyboard again what work is terribly weird, maybe becouse i started with while loop and while loops from my experience im not sure but imo tent do be logically heavy problematic form tiem to time..what work is void ProcessMicroturnsUntilHuman() { if( game_time < character[HUM].action_end) { while(game_time < character[HUM].action_end) { DispatchActions(); game_time++; } if(game_time == character[HUM].action_end) //** DispatchActions(); } } is there some more proper form of this loop? (the line nioted by ** i know is not needed but overally this loop is weird imo