1598284800

# A Binary String Game

Given a Binary String S. The task is to determine the winner of the game when two players play a game optimally with the string as per the given conditions:

• Player 1 always starts first.
• Two players take turns choosing a whole block of consecutive equal characters and deleting them from a given binary String S.
• Player 1 can choose only an odd number of consecutive equal characters and Player 2 can choose only an even number of consecutive equal characters. The player may choose nothing and count it as their turn only if it is impossible to choose anything.
• After all the characters are removed, the player with maximum scores wins the game and if scores are equal then print “-1”

Input:_ S = “1110011001010”_

Output:_ Player 1_

Explanation:

The selected characters will be in bold and Player 1’s score is Score_1 and Player 2’s score is Score_2 :

Turn 1 : (Player 1) “1110011001010” → “0011001010” Score_1 = 3

Turn 2 : (Player 2) “0011001010” → “00001010” Score_2 = 2

Turn 3 : (Player 1) “00001010”→ “0000010” Score_1 = 4

_Turn 4: (Player 2) “0000010” _

_He cannot do anything as only one ‘1’ is present which is an odd number. _

Also, he can’t choose the ‘0’s as they are odd (5 and 1), Therefore, Score_2 =2

Turn 5:(Player 1) “0000010”→ “000000” Score_1=5

Turn 6:(Player 2) “000000” → “” Score_2 = 2 (No ‘1’ was deleted in this turn)

Final scores: Score_1 = 5 and Score_2 = 2

Therefore, Player 1 wins.

_Input : _S_=__“11111101”_

Output:_ Player 2_

_Explanation: _

Turn 1 : (Player 1) “11111101” → “1111110” Score_1 = 3

Turn 2 : (Player 2) “1111110” → “0” Score_2 = 6

Turn 3 : (Player 1) “0” → “” Score_1 = 3

Final scores: Score_1 = 3 and Score_2 = 6

Therefore, Player 2 wins.

**Approach: **

1. If we observe this game carefully, we understand that the only consecutive 1s are contributing to the scores of these players.
2. Create a list to store the lengths of the consecutive 1s in the string.
3. Sort the list in descending order.
4. Now iterate over the list and if the list element is odd it will be added to the score of the Player 1 and if it is even it will be added to the score of the Player 2.
5. Now if the score of the Player 1 is greater than the score of the Player 2 then print “Player 1” and if the score of the Player 2 is greater than the score of the Player 1 then print “Player 2”.
6. Print “-1” if there is a tie i.e., scores are same.

Below is the implementation of the above approach.

• Java

`// Java program for the above approach`

`**import**` `java.io.*;`

`**import**` `java.util.*;`

`**class**` `GFG {`

`// Function to return the result of`

`// the game`

`**public**` `**static**` `String gameMax(String S)`

`{`

`// length of the string`

`**int**` `N = S.length();`

`// List to maintain the lengths of`

`// consecutive '1's in the string`

`List<Integer> list =` `**new**` `ArrayList<>();`

`// Variable that keeps a track of`

`// the current length of the block`

`// of consecutive '1's`

`**int**` `one =` `0``;`

`**for**` `(``**int**` `i =` `0``; i < N; i++) {`

`**if**` `(S.charAt(i) ==` `'1'``) {`

`one++;`

`}`

`**else**` `{`

`// Adds non-zero lengths`

`**if**` `(one !=` `0``) {`

`list.add(one);`

`}`

`one =` `0``;`

`}`

`}`

`// This takes care of the case`

`// when the last character is '1'`

`**if**` `(one !=` `0``) {`

`list.add(one);`

`}`

`// Sorts the lengths in`

`// descending order`

`Collections.sort(list,`

`Collections.reverseOrder());`

`// Scores of the 2 players`

`**int**` `score_1 =` `0``, score_2 =` `0``;`

`**for**` `(``**int**` `i =` `0``; i < list.size(); i++) {`

`// For player 1`

`**if**` `(list.get(i) %` `2` `==` `1``) {`

`score_1 += list.get(i);`

`}`

`// For player 2`

`**else**` `{`

`score_2 += list.get(i);`

`}`

`}`

`// In case of a tie`

`**if**` `(score_1 == score_2)`

`**return**` `"-1"``;`

`// Print the result`

`**return**` `(score_1 > score_2) ?` `"Player 1"`

`:` `"Player 2"``;`

`}`

`// Driver Code`

`**public**` `**static**` `**void**` `main(String[] args)`

`{`

`// Given string S`

`String S =` `"11111101"``;`

`// Function Call`

`System.out.println(gameMax(S));`

`}`

`}`

Time Complexity:_ O(N)_

_Auxiliary Space: _O(N)

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

#game theory #greedy #strings #binary-string

1652250166

## Binary MLM Software Demo | Binary Compensation Plan, MLM Woocommerce

Binary MLM Software Demo | Binary MLM Compensation Plan, MLM Woocommerce Price USA, Philippines : Binary MLM Woocommerce Software is a web application that integrate with the Woo-commerce plugin and helps to manage binary MLM networks. LETSCMS provide worldwide service, such as USA, Hong Kong, China, UK, UAE, Jordan, Saudi Arabia, Pakistan, Philippines, Japan, Singapore, Romania, Vietnam, Canada, Hong Kong, Russia, Hungary, Romania, Poland, Thailand, Laos and many others.

Binary MLM Woo-commerce includes a two legged structure where in a parent Node has two sub nodes where each new distributor or members is placed in either left or right sub-tree. One sub-tree is known as a Power Leg or Profit Leg while the second sub-tree is a Profit Leg or a weak leg.. It  is one of the basic Binary MLM plan which is required by all the MLM organizations be it small or large. The binary MLM plan helps admin managing users or sub nodes in a binary network to keep record of their income, expenses etc.

Front Demo : https://wpbmw.mlmforest.com/?page_id=56

Features
Payout Reports.
Report to show complete details of an individual payouts.
Affiliate Commission.
Pair Commission .
Bonus Commission.
Specify eligibility criteria in the admin.
Configuration of commission and bonus details in the admin.
Service Charges for payout.
Run payouts manually.
Payout Detail based on user in admin .

Frontend Features
Register a Binary MLM User from provided registration page.
Register new Members using Genealogy.
New Join Network Page for non-Network Members .
MLM registration can happen by the Checkout page also.
Members can view full payout details in their account.

If you want to know more information and any queries regarding Binary MLM Woo-commerce, you can contact our experts through
Skype: jks0586,
Mail: letscmsdev@gmail.com,
Website: www.letscms.com, www.mlmtrees.com,
Call/WhatsApp/WeChat: +91-9717478599.

#mlm_plan #Binary_mlm #binary_mlm_plan #Binary_mlm_wordpress_plugin #Binary_mlm_woo-commerce #binary_mlm_ecommerce #binary_mlm_software #binary_mlm_wp_plugin #biary_mlm_ecommerce #mlm_plan

1602565700

## Game Development with .NET

We’ve launched a new Game Development with .NET section on our site. It’s designed for current .NET developers to explore all the choices available to them when developing games. It’s also designed for new developers trying to learn how to use .NET by making games. We’ve also launched a new game development Learn portal for .NET filled with tutorials, videos, and documentation provided by Microsoft and others in the .NET game development community. Finally, we launched a step-by-step Unity get-started tutorial that will get you started with Unity and writing C## scripts for it in no time. We are excited to show you what .NET has to offer to you when making games. .NET is also part of Microsoft Game Stack, a comprehensive suite of tools and services just for game development.

#### .NET for game developers

.NET is cross-platform. With .NET you can target over 25+ different platforms with a single code base. You can make games for, but not limited to, Windows, macOS, Linux, Android, iOS, Xbox, PlayStation, Nintendo, and mixed reality devices.

C## is the most popular programming language in game development. The wider .NET community is also big. There is no lack of expertise and support you can find from individuals and user groups, locally or online.

.NET does not just cover building your game. You can also use it to build your game’s website with ASP.NET, your mobile app using Xamarin, and even do remote rendering with Microsoft Azure. Your skills will transfer across the entire game development pipeline.

#### Available game engines

The first step to developing games in .NET is to choose a game engine. You can think of engines as the frameworks and tools you use for developing your game. There are many game engines that use .NET and they differ widely. Some of the engines are commercial and some are completely royalty free and open source. I am excited to see some of them planning to adopt .NET 5 soon. Just choose the engine that better works for you and your game. Would you like to read a blog post to help you learn about .NET game engines, and which one would be best for you?

#.net #.net core #azure #c# #game development #azure #cryengine #game developers #game development #game development with .net #game engines #games #monogame #playfab #stride #unity #visual studio #waveengine

1598284800

## A Binary String Game

Given a Binary String S. The task is to determine the winner of the game when two players play a game optimally with the string as per the given conditions:

• Player 1 always starts first.
• Two players take turns choosing a whole block of consecutive equal characters and deleting them from a given binary String S.
• Player 1 can choose only an odd number of consecutive equal characters and Player 2 can choose only an even number of consecutive equal characters. The player may choose nothing and count it as their turn only if it is impossible to choose anything.
• After all the characters are removed, the player with maximum scores wins the game and if scores are equal then print “-1”

Input:_ S = “1110011001010”_

Output:_ Player 1_

Explanation:

The selected characters will be in bold and Player 1’s score is Score_1 and Player 2’s score is Score_2 :

Turn 1 : (Player 1) “1110011001010” → “0011001010” Score_1 = 3

Turn 2 : (Player 2) “0011001010” → “00001010” Score_2 = 2

Turn 3 : (Player 1) “00001010”→ “0000010” Score_1 = 4

_Turn 4: (Player 2) “0000010” _

_He cannot do anything as only one ‘1’ is present which is an odd number. _

Also, he can’t choose the ‘0’s as they are odd (5 and 1), Therefore, Score_2 =2

Turn 5:(Player 1) “0000010”→ “000000” Score_1=5

Turn 6:(Player 2) “000000” → “” Score_2 = 2 (No ‘1’ was deleted in this turn)

Final scores: Score_1 = 5 and Score_2 = 2

Therefore, Player 1 wins.

_Input : _S_=__“11111101”_

Output:_ Player 2_

_Explanation: _

Turn 1 : (Player 1) “11111101” → “1111110” Score_1 = 3

Turn 2 : (Player 2) “1111110” → “0” Score_2 = 6

Turn 3 : (Player 1) “0” → “” Score_1 = 3

Final scores: Score_1 = 3 and Score_2 = 6

Therefore, Player 2 wins.

**Approach: **

1. If we observe this game carefully, we understand that the only consecutive 1s are contributing to the scores of these players.
2. Create a list to store the lengths of the consecutive 1s in the string.
3. Sort the list in descending order.
4. Now iterate over the list and if the list element is odd it will be added to the score of the Player 1 and if it is even it will be added to the score of the Player 2.
5. Now if the score of the Player 1 is greater than the score of the Player 2 then print “Player 1” and if the score of the Player 2 is greater than the score of the Player 1 then print “Player 2”.
6. Print “-1” if there is a tie i.e., scores are same.

Below is the implementation of the above approach.

• Java

`// Java program for the above approach`

`**import**` `java.io.*;`

`**import**` `java.util.*;`

`**class**` `GFG {`

`// Function to return the result of`

`// the game`

`**public**` `**static**` `String gameMax(String S)`

`{`

`// length of the string`

`**int**` `N = S.length();`

`// List to maintain the lengths of`

`// consecutive '1's in the string`

`List<Integer> list =` `**new**` `ArrayList<>();`

`// Variable that keeps a track of`

`// the current length of the block`

`// of consecutive '1's`

`**int**` `one =` `0``;`

`**for**` `(``**int**` `i =` `0``; i < N; i++) {`

`**if**` `(S.charAt(i) ==` `'1'``) {`

`one++;`

`}`

`**else**` `{`

`// Adds non-zero lengths`

`**if**` `(one !=` `0``) {`

`list.add(one);`

`}`

`one =` `0``;`

`}`

`}`

`// This takes care of the case`

`// when the last character is '1'`

`**if**` `(one !=` `0``) {`

`list.add(one);`

`}`

`// Sorts the lengths in`

`// descending order`

`Collections.sort(list,`

`Collections.reverseOrder());`

`// Scores of the 2 players`

`**int**` `score_1 =` `0``, score_2 =` `0``;`

`**for**` `(``**int**` `i =` `0``; i < list.size(); i++) {`

`// For player 1`

`**if**` `(list.get(i) %` `2` `==` `1``) {`

`score_1 += list.get(i);`

`}`

`// For player 2`

`**else**` `{`

`score_2 += list.get(i);`

`}`

`}`

`// In case of a tie`

`**if**` `(score_1 == score_2)`

`**return**` `"-1"``;`

`// Print the result`

`**return**` `(score_1 > score_2) ?` `"Player 1"`

`:` `"Player 2"``;`

`}`

`// Driver Code`

`**public**` `**static**` `**void**` `main(String[] args)`

`{`

`// Given string S`

`String S =` `"11111101"``;`

`// Function Call`

`System.out.println(gameMax(S));`

`}`

`}`

Time Complexity:_ O(N)_

_Auxiliary Space: _O(N)

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

#game theory #greedy #strings #binary-string

1622631378

## AI in Game Development - ITChronicles

For some years, artificial intelligence (AI) has been penetrating almost all digital spaces. After playing an instrumental role in digital communication and real-time problem-solving in many industries, AI in game development is expanding too. The significant impact of AI has played an instrumental role in the mobile and console game industry’s success.

AI has taken game development to new heights. AI helps to ensure greater satisfaction for gamers by addressing their objectives and concerns. AI also helps game developers come with higher-value additions and revisions based on data-driven insights,

AI is now showcasing many unprecedented opportunities in the gaming industry besides fulfilling its primary promise of delivering a great gaming experience. Here are some of the key ways AI is affecting the development of modern games.

**AI-Based Player Profiling **

Game developers now include AI-based player profiling within the game frameworks. This offers a game-playing experience that suits the target player profiles’ characteristic elements. You can hire game developers in India who are experts in creating AI-based player profiles equipped and thoroughly trained with game playing styles and different in-game player behaviors. These talented game developers can deliver a highly real-life environment within the game thanks to precise player profiling based on AI technology.

#game development #game programming #game algorithms #game character design

1649915425

## Top 5 Teen Patti Game Development Company

Teen Patti is the most popular Indian and European card betting game. This game is among the most common and famous variations of the poker games. When it comes to gambling games, Teen Patti secures a favourable spot among the sports lovers by entertaining them highly.

## BR Softech -

BR Softech is the trusted name in online Teen Patti Game Development. We have been working with Mobile, PC and Web clients since 2008 to help them create online game applications that increase income opportunities and drive customer loyalty. Our Teen Patti games are built with the highest standards of quality to ensure maximum entertainment and involvement from our players.

## Duplex Techno Pvt. Ltd. -

Duplex Techno Pvt. Ltd. is a leading and experienced teen patti game development company based in Lucknow, India. We have a highly efficient team of expert game developers who are best at developing a game that provides the user with an extraordinary gaming experience. If you are too looking to develop an amazing game app for your business then our professional developers will be highly beneficial for you.

## Orion Infosolutions -

Orion Infosolutions offers the best services amongst Teen Patti Game developers in India. We are passionate about using high-grade technologies and equipment for creating games that are played globally. We have a large player base and assist our clients with great marketing research to make the games more profitable than ever before.

## Artoon Solutions Pvt. Ltd. -

Artoon Solutions Pvt. Ltd. a leading Software development company in India, develops card game software for its international clients through its established Artoon technologies. This exclusive Teen Patti is their latest invention and combines the classic card game with online gaming to enjoy it with multiple players. For more information about our presence in this segment.

## Capermint Technologies -

Capermint Technologies has developed numerous Real Money Teen Patti Games, and all the games incorporate advanced features that attract millions of players worldwide. We make sure that your requirements are met in the game, and with our experienced designers we develop games with exciting features. Our trained developers use the latest technology to create the most advanced Teen Patti Game.