Resolute Posted October 13, 2012 Posted October 13, 2012 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
ndx Posted October 27, 2012 Posted October 27, 2012 (edited) 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 October 27, 2012 by ndx
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now