[GAME]Noggin!

release
puzzle
game

#1

Noggin!
A unique game where the objective is simply to flip all of the tile over. There is a catch though (isn’t there always?), You can only move the amount of spaces shown on your current tile. Sounds easy, but it isn’t. Just give it a try, you’ll see how frustratingly fun it is!

01 02

03 04

Noggin.bin (188.8 KB)
NogginSource.zip (151.0 KB)

  • Source, first line includes permission to use the titlescreen font and sfx license.

This is my first attempt at anything using python. It was created within a couple of weeks in my spare time (an hour here and here). I think it turned out OK.

As always, all comments are welcome.


#2

I played the first version and found it really difficult without any instructions :slight_smile:


#3

I’m still a bit unsure about the rules.
Is it supposed to be ‘you can only move exactly X spaces’ or ‘you can move up to and including X spaces’?


#4

Only exactly X spaces. So if you get a 10, you have to move exactly 10 spaces. It would be easy otherwise!
02


#5

Ah, I missed the ‘exactly’ there. I find the grey on green a little bit hard to read.

What about the K, Q and ‘!’ tiles?


#6

scroll down the instructions with the d-pad :slight_smile:


#7

@spinal I think I found a bug .or sure would like to believe it is one… I got stuck flipping a Q. But all tiles available we’re flipped so wasn’t able to select anything, I had 3 ‘!’ so wasn’t too concerned, but to my surprise pressing B in that case didn’t let me use a ‘!’ to flip any tiles.

What’s worse was that there was 3 tiles left to flip and i had 3 ‘!’ …


#8

Hmm, pressing B only work if your on your starting tile. So sometimes you’ll need to press b twice, once to reset the move then once again to use the !.


#9

Yeah we did that believe me. If it would of work I would of won the game lol I was hammering the b button on the starting tile.


#10

I’ll see if I can track that bug down, I have a little idea about tracking unplayable moves too. Might take some doing though.


#11

Now I’ve had chance to run it and figure out the rules,
I think it would be simple enough to detect ‘no more moves’ from a numbered tile.
The special tiles should be relatively simple since they only need at least 1 free tile in a row or a column (K & Q), or 1 free tile anywhere (!).

Really it’s just a matter of:

  • Does the player have any more free turns?
  • Can the player move exactly N tiles?

The first check is easy. The second check is a bit more complicated,
but it would essentially just be a variant of flood-fill and/or Dijkstra’s algorithm.
(Some of that explanation is a bit more complicated than you need to worry about because your ‘nodes’ (tiles) aren’t weighted. Although technically you could look at it as a turned tile having a distance of infinity (or at least greater than N).)

However, since you know the player can only visit tiles within an manhattan distance of N,
you can limit the search to just those tiles:

grid_width = 7
grid_height = 7

def get_card_index(x, y):
	return ((y * grid_width) + x)

def get_card(x, y):
	index = get_card_index(x, y)
	return cardList[index]

def manhattan_distance(x0, y0, x1, y1):
	return (abs(x0 - x1) + abs(x0 - x1))
	
# Possibly better version
def get_dijkstra_candidates(x0, y0, limit, cards):
	return [(x1, y1) for y1 in range(y0 - limit, y0 + limit + 1) for x1 in range(x0 - limit, x0 + limit + 1)]
	
# Alternative version
def alternative_get_dijkstra_candidates(x0, y0, limit, cards):
	return [(x1, y1) for y1 in range(grid_height) for x1 in range(grid_width) if (manhattan_distance(x0, y0, x1, y1) <= limit)]

(Ironically if the player didn’t have to move exactly N tiles then figuring this out would be a lot easier.)

(Edit: Fixed the code and figured out a possibly better way of getting the candidate coordinates in the process.)


Normally I’d have a go at modifying your code to do this,
but since this is a competition I think it would be unfair to actually contribute code.
At least until after the contest is over.


By the way, Python does have True and False, like most civilised languages.


#12

I’m not sure that detecting being unable to move is 100% necessary, games like Solitaire don’t do it and nobody seems to mind.
I am however adding a check to see if you get stuck in a King or Queen move, as well as a game over screen.


#13

Part of the reason Solitaire doesn’t do it is because Solitaire was originally played by hand and when it’s played by hand people would have had to discern if there were no moves left by themselves.

I suspect Solitaire would require a game tree to figure out if there were no playable moves left,
and those can be really memory hungry if there’s a lot of possible moves.

Noggin is a lot less complex because the player is more constrained in their choices.


#14

Funny you should mention that, Noggin started out as a card game, when my step brother was trying to come up with a system to ‘cheat’ at pairs.


#15

First post updated with a couple of bug fixes and added sound and game win screen.