Jump to content

Python Board Game..!


Resolute

Recommended Posts

Hey there,

I have an assignment going on currently, where I have to design a board game through the use of the language Python, and was wondering if anyone is able to help! Any and all input would be greatly appreciated. :)

 

I'm having trouble with replacing elements correctly, as unexpected "S" pieces are showing up, which is shown in the picture link stated below.

http://tinypic.com/r/2e201w6/6

 

When I move from D5 to D2, a support piece "S" appears on D4. Similarly, on a 7 by 7 board... I move from G7, to G2, extra support pieces appear on G3, G5, G6.

http://tinypic.com/r/25g6trp/6

 

In the pictures, you are able to see in the window the function I have written that replaces elements with an "S" or ",", however I have no idea where these pieces are coming from, as my code only refers to one specific element of the board..

Any ideas? :) If you need to see my whole code, please message me, as I do not want to post it online for risks of plagiarism of any sort through the auto checker provided by the University. :)

Thankyou!

 

-- apologies for the double post. I'm not sure where this question is supposed to be posted. :X

Link to comment
Share on other sites

  • 2 weeks later...

I'm not sure you still need help, if so I think I can, just let me know.

 

In your code I see:

 

if function(x) == False:

None

else:

OtherCode().

 

1. instead of 'None', you should use 'pass'.

2. Don't use '== False', use '!function(x)' it's easier to read.

3. Don't negate when you don't need, your code can be written:

if function(x):

OtherCode()

Edited by ndx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.