On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Dev Log] Dr.NIM

A topic by Mtaethefarmer created Jul 28, 2017 Views: 311 Replies: 2
Viewing posts 1 to 2
(1 edit)

On the first day I drafted up what type of game I wanted to make. 

The game is based around Multi-Pile NIM.

You are a heart pumping blood to the body. Do not let Dr.NIM take all of your blood.

Players take turns removing from 1 to all of the units of blood in any one part he chooses.

If you take the last amount of blood you win.

A more detailed description is found in the Game Concept html file.

Thank you Gary Darby for providing an explanation for the algorithm.

http://delphiforfun.org/programs/NIM2_Multi.htm

[27JUL17  DAY: TWO]


One the second day I wanted to create a skeleton of the game with basic mechanics. 

Right now its a clicker where there a 3 piles and each pile has an amount that can be clicked on.

 Once clicked the that will be the only pile that can be selected and will subtract one from that pile until it reaches 0. 

Clicking the end turn button will signify the end of your turn.

Very bare bones with no images or animations as of yet. So nothing impressive. 


Next on the list:

  •  Add Dr.Nim as a opponent who will select a random pile to take from
  • Create gdscript pseudo-code that will allow Dr.Nim to know which pile to take from  and how much to take (SAFE/UNSAFE) moves
  • Create a title and Game Over Screen
  • Add images to tell the story / get rid of super boring text only display
  • Background Sound and Sound FX
  • Credits


[26JUL17 DAY: ONE]

Setup
ARRAY 3 body parts 
INT Each body part has 10 units of blood
BOOL The player chooses to go first or second
F(X) decimal to binary
F(X) binary to decimal

Game Loop
Players take turns removing from 1 to all of the units of blood in any one part he chooses.

End condition/ Win condition
Every pile has 0 units of blood
Player that takes the last unit of blood wins.

Strategy
Inherit Unsafe moves then turn them into Safe moves.
Inherit Safe moves then take 1 unit from the biggest pile.

Write the number of each pile in binary 
Check whether the sum of the bits is odd or even
Numbers with all the bits in each column being even is SAFE
Odd sums in any column are UNSAFE

Example:

Sticks in pileBinary RepresentationSafe/Unsafe?
 Column Values 
    8 4 2 1  
3   0 0 1 1 
4   0 1 0 0 
7+ 0 1 1 1     
Column Sums   0 2 2 2Safe
  
5   0 1 0 1 
1   0 0 0 1 
6+ 0 1 1 0     
Column Sums  0 2 1 2Unsafe

*Any safe position will become unsafe by ANY move.
*Any unsafe position can be made safe with the appropriate move

To find that appropriate move:
      Find the leftmost column with an odd sum.  

151 1 1 
101 0 1 0 
30 0 1 1 
Column Sums2 1 3 2Unsafe

     Find a row (pile) that has a 1 in this column.

151 1 1 1 
101 0 1 0 
30 0 1 1 
Column Sums2 1 3 2Unsafe

      Starting at this column and moving to the right, flip every binary digit (0 becomes 1 and 1 becomes 0) for each column whose sum is odd.

15(Start)1 1 1 1  ->    1 0 0 1 9(End)
101 0 1 0 
30 0 1 1 
Column Sums2 0 2 2Safe

     So our objective is to inherit unsafe positions and use our move to make them safe.  Since the next-to-last move consists of one or more sticks in a single pile (an unsafe position) we will eventually inherit this board and proceed to make it safe (and win!) by removing all remaining sticks in that. 

The key arrangements of piles you can safely leave, in descending order, organized by descending number of piles, are as follows:

3 piles
----------
11, 10, 1
11, 9, 2
11, 8, 3
10, 9, 3
10, 8, 2
9, 8, 1
7, 6, 1
7, 5, 2
7, 4, 3
6, 5, 3
6, 4, 2
5, 4, 1
3, 2, 1

Jam Host

hey! thanks for joining! looks like you've got the logic figured out, so good luck with the rest of the jam! interesting concept you have so far. O:

I appreciate the words of encouragement, thank you. :D