Noob learns to code in 3 months

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » June 16th, 2017, 2:59 pm

Definitely watch Redpill Stack first. And don't worry about it if shit goes over your head, absorb what you can and ignore the rest for now, it's not super important

Now the thing about the recursion and Fibonacci, of course it is fine to use iteration (looping) instead of recursion, but the fact that you tried recursion and were not able to make it work should not be ignored. This is a red flag that must be paid attention to. You might think "Who cares, why would I ever need Fibonacci anyways?", but that's not the point. The actual algorithms and examples shown in my videos are seldom the point, the point is the higher levels skills and concepts being demonstrated and exercised. In this case, the skill of thinking in terms of recursion and using that to break a problem down.

Now remember, I already covered recursive Fibonacci back in Beginner 24. I selected it as the first example of recursion because it is fairly straightforward. If you had problems recalling that and recreating it, it say that you need to work on recursion. To be honest, recursion isn't used super often in making games, and it can often be replaced with a less elegant loop solution even in cases where it would be used, but there are some situation where you really need to understand it. One such situation is the depth first search algorithms such as Minimax. And these algorithms are used all over the place for game AI, so you really want to be able to understand them.

The other red flag is the fact that you could not make the int2str function. This kind of ability to take a goal, analyse it can figure out a simple math solution, and then implement it with an algorithm is very important stuff to be able to do. I noticed that this sort of thing is not one of your strongpoints from the time when you tried to get alpha blending to work.

When you run into situation like this, it is very important in this point in your growth that you do not ignore the issue. It can be easy to say 'why would I need fibonacci?' or 'why would I write int2str when there are perfectly good functions in the std lib i can use already?', but that is missing the point. The point is the skills needed to solve these problems are also the skills needed to solve other problems that you will not be able to ignore. So you got to face this stuff head on.

What I recommend is, when you run into something like this in the tutorials, after you give up and look at the solution, take a day or two, and then go back to it and see if you can do it yourself now without peeking, and if not go back and study it again, until you understand it like the back of your hand. And also, seek out similar problems and try and solve them. Seek out other algorithms for recursion (simple ones at first) and try and solve them or study them until you know them inside and out. The same goes for the int2str stuff. I recommend doing simple algorithm challenges to boost these skill.

Don't take this as a roast bro, just some advice that I hope you take to heart. Everybody has their strengths and weaknesses. I think you have a lot of strengths that will serve you well in game dev, but you need to work on these weaknesses as well.

Also, good idea to steal the simon says idea. Wasting time spinning your wheels cuz you can't think of a project is silly. Just do the first thing that comes to mind and don't be picky. Anything is better than nothing. If you come up with a killer idea, you can always transfer over, but in the meantime just pick something--anything and run with it.
Chili

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » June 16th, 2017, 11:43 pm

More or less done with simon says.
I compare the sequences after the player has put in a whole sequence, so he doesn't fail right away if he pushes the wrong button and there's more moves left. This is mostly due to the fact that I've never really played simon says.

Other than that I guess the code is quite a mess as usual but I did as well as I could.

If you want to try the game (it's boring) you have to click anywhere on the screen for it to start.
https://github.com/Yumtard/SimonSays/tree/master/Engine

@Chili
I'm not trying to ignore stuff.
I do have a lot more weakpoints than strongpoints(can't think of a single one atm lol) and it just makes learning slow I guess. If you watched me code I'd bet you'd find tons of more red flags.
I did look up recursion today in the book, read a few pages about it and actually understood a big thing about them that I had not grasped before, so I guess that's good. Will explain more about it tomorrow when I've had some rest.
Will look up more about recursion tomorrow and check out the recursion vid again and if I have time (else on sunday) I'll watch tutorial 3 again and see if I can make more sense of it.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Noob learns to code in 3 months

Post by albinopapa » June 17th, 2017, 3:44 am

I also have troubles with recursion to be honest. One of the reasons I've shied away from it is the anticipated performance hit of unrolling the stack. As for the depth first search algorithm, I used it when I created mazes. The difference being I used a loop instead of recursion. Creating a quad/octree is simple using recursion, haven't tried using loops though. Sorting algorithms use recursion, like quick sort.

I do need to practice more of those algorithms, I find I have to look them up each time as I can't seem to reason about them and come up with a logical solution on my own for some reason.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » June 17th, 2017, 8:30 am

Alright so this is the thing that finally made sense for me about recursion yesterday. I'm sure chili has already covered this and that I should already know this but I guess I didn't understand it correctly at first.

Code: Select all

int nfak(int n)
{
	if (n <= 0)
	{
		return 1;
	}
	return n * nfak(n - 1);
}

int main()
{
	int number = nfak(3);

	while (!_kbhit());
	return 0;
}



So the thing that has been confusing me is that I've thought of this as doing a loop where n will decrease every iteration and "in that case wouldn't n just finally reach 0 and the function would return 1 instead of 6 to int number?"

Well here's how it actually work

Code: Select all

int number = nfak(3);
The function is called, space in memory is generated for the paramete n which has the value 3

Code: Select all

int nfak(int n)
{
//n is 3 is bigger than 0
	if (n <= 0)
	{
		return 1;
	}
//funcion is called again, new space in memory is generated for this function call nfak(2)
	return n * nfak(n - 1);
}
second call

Code: Select all

int nfak(int n)
{
//2 is bigger than 0 so we call the function again in return
	if (n <= 0)
	{
		return 1;
	}
//once again new memory space is generated for nfak(1)
	return n * nfak(n - 1);
}
3rd call

Code: Select all

int nfak(int n)
{
//1 is bigger than 0 so we generate new space agan, not for nfak(0)
	if (n <= 0)
	{
		return 1;
	}
	return n * nfak(n - 1);
}
4th call

Code: Select all

int nfak(int n)
{
//n is now == 0 so we return 1
	if (n <= 0)
	{
		return 1;
	}
	return n * nfak(n - 1);
}
now that we return 1, we don't return it directly to int number
we're returning 1 from the 4th call to the third call

third call again

Code: Select all

int nfak(int n)
{
	if (n <= 0)
	{
		return 1;
	}
//nfak(n-1) returned 1
//the value of n for this call was 1 so we return 1*1 to the second function cal
	return n * nfak(n - 1);
}
//second call again

Code: Select all

int nfak(int n)
{
	if (n <= 0)
	{
		return 1;
	}
//nfak(n-1) returned 1 
//the value of n in this call is 2 so we return 2 * 1
	return n * nfak(n - 1);
}
first call again

Code: Select all

int nfak(int n)
{
	if (n <= 0)
	{
		return 1;
	}
//nfak(n-1) returned 2
//n in the first call was 3, so now we return 2*3 to int number
	return n * nfak(n - 1);
}
So yeah this whole part makes a lot more sense to me now.

I'm invited to a party today so won't have time to rewatch tutorial 3 today :x
But I'm gonna read more about recursion, watch chilis recursion video and try to practice a couple algorithms

@albinopapa
Feeels kinda good to hear I'm not the only one having trouble :p Sometimes it feels like it

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: Noob learns to code in 3 months

Post by Zedtho » June 17th, 2017, 11:00 am

Yumtard wrote:More or less done with simon says.
I compare the sequences after the player has put in a whole sequence, so he doesn't fail right away if he pushes the wrong button and there's more moves left. This is mostly due to the fact that I've never really played simon says.

Other than that I guess the code is quite a mess as usual but I did as well as I could.

If you want to try the game (it's boring) you have to click anywhere on the screen for it to start.
https://github.com/Yumtard/SimonSays/tree/master/Engine

@Chili
I'm not trying to ignore stuff.
I do have a lot more weakpoints than strongpoints(can't think of a single one atm lol) and it just makes learning slow I guess. If you watched me code I'd bet you'd find tons of more red flags.
I did look up recursion today in the book, read a few pages about it and actually understood a big thing about them that I had not grasped before, so I guess that's good. Will explain more about it tomorrow when I've had some rest.
Will look up more about recursion tomorrow and check out the recursion vid again and if I have time (else on sunday) I'll watch tutorial 3 again and see if I can make more sense of it.

You beat me to it! Good job!

P.S I don't mind at all, it's not like simon says is an extremely unique idea :D
Last edited by Zedtho on June 17th, 2017, 4:09 pm, edited 1 time in total.

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » June 17th, 2017, 12:21 pm

Sorry about that :P hope you don't mind!

Now you can set the challenge to do a cooler version than me tho :D

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » June 17th, 2017, 1:32 pm

Study update
Watched chilis vid on recursion. I somehow can't recall ever watching it. There was a comment from me on the youtube page so I guess I watched it at some point.
Think I should redo the minesweeper part next week, don't think I ever finished it before I took a break (was forced to) actually.

Read some more about recursion in the book. Think I have a better idea about it. Haven't had time to try and make any algorithms yet. Will do tomorrow!

I went full on insane and made a new putpixel call that puts bigger pixels on the screen.

Code: Select all

void Graphics::PutBigPixel(int x, int x_off, int y, int y_off, Color c)
{
	const int dim = 5;
	const int padding = 1;
	DrawRect(x + ((dim + padding) * x_off), y + ((dim + padding) * y_off), dim, dim, c);
}
I realize now that I should probably pass dim and padding as arguments in case I want to do it with different size, kinda messed up there.

Then I manually drew 0-9 which I will use to display the number of moves in the sequence.
Spoiler:

Code: Select all

void Text::DrawNumber(Graphics & gfx)
{
	switch (value)
	{
	case 0:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);
		gfx.PutBigPixel(x, 0, y, 3, color);
		gfx.PutBigPixel(x, 0, y, 4, color);
		gfx.PutBigPixel(x, 0, y, 5, color);

		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);

		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 4, y, 2, color);
		gfx.PutBigPixel(x, 4, y, 3, color);
		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);

		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 3, y, 6, color);
		break;
	case 1:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 1, y, 1, color);
		gfx.PutBigPixel(x, 2, y, 1, color);

		gfx.PutBigPixel(x, 0, y, 6, color);
		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 3, y, 6, color);
		gfx.PutBigPixel(x, 4, y, 6, color);

		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 2, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 4, color);
		gfx.PutBigPixel(x, 2, y, 5, color);

		break;
	case 2:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 5, color);
		gfx.PutBigPixel(x, 0, y, 6, color);

		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 1, y, 4, color);
		gfx.PutBigPixel(x, 1, y, 6, color);

		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 6, color);

		gfx.PutBigPixel(x, 3, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 2, color);
		gfx.PutBigPixel(x, 3, y, 6, color);

		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 4, y, 6, color);
		break;
	case 3:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);
		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 4, y, 2, color);
		gfx.PutBigPixel(x, 3, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);
		gfx.PutBigPixel(x, 3, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 0, y, 5, color);
		break;
	case 4:
		gfx.PutBigPixel(x, 0, y, 0, color);
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);
		gfx.PutBigPixel(x, 0, y, 3, color);
		gfx.PutBigPixel(x, 0, y, 4, color);

		gfx.PutBigPixel(x, 1, y, 4, color);
		gfx.PutBigPixel(x, 2, y, 4, color);
		gfx.PutBigPixel(x, 3, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 4, color);

		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 5, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		break;
	case 5:
		gfx.PutBigPixel(x, 0, y, 0, color);
		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);
		gfx.PutBigPixel(x, 4, y, 0, color);

		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);
		gfx.PutBigPixel(x, 0, y, 3, color);

		gfx.PutBigPixel(x, 1, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 3, y, 3, color);

		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);

		gfx.PutBigPixel(x, 3, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 0, y, 6, color);
		break;
	case 6:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);
		gfx.PutBigPixel(x, 0, y, 3, color);
		gfx.PutBigPixel(x, 0, y, 4, color);
		gfx.PutBigPixel(x, 0, y, 5, color);

		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);
		gfx.PutBigPixel(x, 4, y, 1, color);

		gfx.PutBigPixel(x, 1, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 3, y, 3, color);
		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);

		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 3, y, 6, color);
		
		break;
	case 7:
		gfx.PutBigPixel(x, 0, y, 0, color);
		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);
		gfx.PutBigPixel(x, 4, y, 0, color);
		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 3, y, 2, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 4, color);
		gfx.PutBigPixel(x, 2, y, 5, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		break;
	case 8:
		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);

		gfx.PutBigPixel(x, 1, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 3, y, 3, color);

		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 3, y, 6, color);

		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);

		gfx.PutBigPixel(x, 0, y, 4, color);
		gfx.PutBigPixel(x, 0, y, 5, color);

		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 4, y, 2, color);

		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);
		
		break;
	case 9:
		gfx.PutBigPixel(x, 1, y, 0, color);
		gfx.PutBigPixel(x, 2, y, 0, color);
		gfx.PutBigPixel(x, 3, y, 0, color);

		gfx.PutBigPixel(x, 1, y, 3, color);
		gfx.PutBigPixel(x, 2, y, 3, color);
		gfx.PutBigPixel(x, 3, y, 3, color);

		gfx.PutBigPixel(x, 1, y, 6, color);
		gfx.PutBigPixel(x, 2, y, 6, color);
		gfx.PutBigPixel(x, 3, y, 6, color);

		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color);
		gfx.PutBigPixel(x, 0, y, 5, color);

		gfx.PutBigPixel(x, 4, y, 1, color);
		gfx.PutBigPixel(x, 4, y, 2, color);
		gfx.PutBigPixel(x, 4, y, 3, color);
		gfx.PutBigPixel(x, 4, y, 4, color);
		gfx.PutBigPixel(x, 4, y, 5, color);
		
		break;
	}
}
Fun times.

There might be a better way of doing this but this is what I had in my head for the moment and felt like trying it.

Think the whole class is probably not a great idea because in game I have to create 3 objects of the class, first number, second number and third number. There's probably a better way of doing this.
Maybe make a text manager class that handles those text objects and then I'll just have one single textmanager object in game.

Code: Select all

#include "Text.h"

Text::Text(int x_in, int y_in, Order order_in)
	:
	x(x_in),
	y(y_in),
	order(order_in)
{
}

void Text::Update(int score)
{
	SetValue(score);
}

void Text::SetValue(int score)
{
	if (score < 10)
	{
		if (order == first)
		value = score;
	}

	else if (score < 100)
	{
		switch (order)
		{
		case first:
			value = score / 10 % 10;
			break;
		case second:
			value = score % 10;
			break;
		default:
			break;

		}
	}

	else
	{
		switch (order)
		{
		case first:
			value = score / 100 % 10;
			break;
		case second:
			value = score / 10 % 10;
			break;
		case third:
			value = score % 10;
			break;

		}
	}
}

void Text::Draw(Graphics & gfx, int score)
{
	if (score < 10 && order == first)
	{
		DrawNumber(gfx);
	}
	else if (score < 100)
	{
		switch (order)
		{
		case first:
			//drawnumber() based on value
			break;
		case second:
			//drawnumber() based on value
			break;
		default:
			break;
		}
	}
	else
	{
		switch (order)
		{
		case first:
			//drawnumber() based on value
			break;
		case second:
			//drawnumber() based on value
			break;
		case third:
			//drawnumber() based on value
			break;
		}
	}
}

void Text::DrawNumber(Graphics & gfx)
{
	switch (value)
	{
	case 0:
		gfx.PutBigPixel(x, 0, y, 1, color);
		gfx.PutBigPixel(x, 0, y, 2, color)..........................................................
		break;
	}
}

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » June 17th, 2017, 4:12 pm

Tried one algorithm just as a warm up for tomorrow before I go get drunk.

Obv dumb function that can't be used for anything.
I wanted to find out how often if you roll 6 dice you will roll one of each (1,2,3,4,5,6)

Result ended up very close to the factorial function from the book :p Will try more algorithms tomorrow!
float dice(float n) //n should just be 6 for this one
{
if (n <= 0.0f)
{
return 1.0f;
}
return n * dice(n - 1) / 6.0f;
}

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » June 17th, 2017, 5:10 pm

Yumtard wrote:I do have a lot more weakpoints than strongpoints(can't think of a single one atm lol)
You got plenty of strong points bro. Probably the most important is the demonstrated ability to stick to a project and take it to some endpoint. Add to that the ability to sustain work on something, to be consistent and to pace yourself well, set reasonable goals and meet them, all that good stuff.

The thing about games programming (most programming really) is your ability to craft ingenious algorithms really isn't going to come into play all that often. So once you reach some baseline level in that area you'll probably be set. More important is the ability to organize system and design robust systems, which is an art in and of itself, but requires more diligence and restraint / caution than it requires genius. I am confident that you can learn these algorithm skills that you need, it should not be an issue. It might take some work but it is 100% doable.

What is far more difficult to teach are the skills of consistency, of industriousness, self-motivation, and the willpower to take an idea and actually see it though to the end with your own two hands. It is a lack of this that I think dooms most to failure, and I think you might have what it takes in this department to succeed.

Looks like you are making some progress in understanding the concept of recursion. It is used all the time in algorithms, like I think papa said sorting algorithms also use it, and also in mathematical proofs and stuff like that. Keep at it solving problems with recursion until it feels comfortable. You don't have to mainline it and drop everything else, but keep it on the backburner at least. Maybe trying to implement something like quicksort yourself might be a good exercise for a number of reasons.

Even though the technique of recursion might not come up in everyday code, it is still a useful tool that you should have. And maybe most important of all, practicing recursion and getting comfortable with the concept will also exercise and strengthen a part of your mind that will aid you in many more places than just coding recursive algorithms.

BTW, really like your Simon Says. Best score was 13 I think :P
Chili

User avatar
Zedtho
Posts: 189
Joined: February 14th, 2017, 7:32 pm

Re: Noob learns to code in 3 months

Post by Zedtho » June 17th, 2017, 6:21 pm

I'm wondering why you're using floats in this situation, because only integers are needed. Also, any integer smaller than 0 cannot be "factorialized" so you wouldn't be able to return 1 for those, but I'm being nitpicky, I doubt anyone has -1 dice... I could suggest that you make two functions, one as an access panel that only takes positive integers, and one beneath that that gets called inside itself but that does accept negative integers too. (Like how dice() is calling itself)

But again, nitpicky mathematicians stuff :P

Post Reply