-
Posts
8 -
Joined
-
Last visited
Reputation Activity
-
Beesman got a reaction from noobhawkia in Snakes, Mongooses and the Ultimate Election Code Chef Challenge
There is no max rule actually - it's just badly worded 4th example.
You should delete the:
if(count>=2) break; I also didn't notice you checking if the moose already ate a snake. It's stated that moose can eat only one snake. Here is example of your code with the check in place and the class is Main.
import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner ob=new Scanner(System.in); int t=ob.nextInt(); for (int i = 0; i <= t; i++) { String arr=new String(); arr=ob.next(); char char_arr[]=arr.toCharArray(); int count=0,count_s=0,count_m=0; for (int j = 1; j < char_arr.length; j++) { if(char_arr[j-1]=='s'&&char_arr[j]=='m') { char_arr[j-1]='*'; char_arr[j]='M'; count++; j++; } else if(char_arr[j-1]=='m'&&char_arr[j]=='s') { char_arr[j]='*'; char_arr[j-1]='M'; count++; } } for(int z=0;z<char_arr.length;z++) { if(char_arr[z]=='s') count_s++; else if(char_arr[z]=='m'||char_arr[z]=='M') count_m++; } if(count_m>count_s) System.out.println("mongooses"); else if(count_m<count_s) System.out.println("snakes"); else System.out.println("tie"); } } }
-
Beesman reacted to TheNaitsyrk in Unreal Engine How to stop playing sound which is executed every frame? (BOOL) C++?
This helped, thank you!
-
Beesman reacted to LUUD18 in How would I go about doing this?
I would suggest make a PHP page. It is a quite easy to learn language. Then on this PHP page add some authentication so not everyone can use it and so the faculty knows who used it. Then you should read on the google Chrome Notification API so the faculty get's an notification on his phone/desktop.
You could use this library for the notifications:
https://github.com/web-push-libs/web-push-php
-
Beesman got a reaction from TheNaitsyrk in Unreal Engine How to stop playing sound which is executed every frame? (BOOL) C++?
I hope i understood you correctly that want to play a sound once the character enters an area but only when he enters and your problem is it starts playing each frame he is in there.
Well you can check if he is beyond the position each time but only set some play sound bool when the crossing happens.
If you want to play the sound only if he just crossed and is in the area, there are many ways to do that.
Simple example that crossed my mind is to control his being in the area for the last frame and the current one.
fe. pseudo code example:
bool isInArea51(Player player){...} //...function that returns if he is in - if it's just some x boundry probably just x => ??.. void playArea51ThemeSong(){...} //...function that plays the sound (probably in another threat bool wasInArea51 = false; //... //... //The block where your stuff you do each frame happens or the tick of the pawn or w/e { //... If( isInArea51(player) && !wasInArea51)//he is in but wasn't here last frame { playArea51ThemeSong();//probably in another threat dunno if unreals sound playing stuff handles this for you } //... wasInArea51 = isInArea51(player); } This will work for re-entering the area and will not loop if you stand directly on the threshold.
-
Beesman reacted to Skanky Sylveon in Programming Language
Python has an easier learning curve, but knowing C++ will probably be more useful. What about Java or C#? Their syntax is similar to C++, but have an easier learning curve.
-
Beesman reacted to ZaTrox in Programming Language
on this question you will get 100 different answers if you ask 100 different people,
-
Beesman reacted to Dat Guy in Programming Language
Java is like C++ with more restrictions, especially concerning memory management. Also it's horribly slow. You should not use it.