This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Doomkiller
Pages: 1 ... 9 10 11 12 13 14 15 [16] 17 18 19 20 21 22 23 ... 115
301
« on: September 03, 2011, 08:16:58 AM »
//what does def do?// def getnextrow(oldrow): size = len(oldrow) newrow = "." * size
for i in range(0, size): char = "." //and what happens here?// if (oldrow[i - 1] == "*") != (oldrow[(i + 1) % size] == "*"): # modulo size so that the index wraps around char = "*" newrow[i] = char
return newrow
firstrow = "..*.**.." nextrow = getnextrow(firstrow) print(nextrow)
302
« on: September 03, 2011, 08:00:26 AM »
Oh, no I know what you mean by the modulo and how the neighbours worked, I meant when I looked at your code, i didn't quite understand what you were doing
303
« on: September 03, 2011, 07:19:39 AM »
Im not too sure how you did it night, care to elaborate more?
Also, I solved it anyway :P
lines = int(raw_input("Number of lines: ")) start = raw_input("Start line: ") firstline = start nextline = [] print firstline for i in range(lines-1): for j in range(len(start)): if (firstline[j-1] == "*" and firstline[j-len(start)+1] == "."): nextline.append("*") elif (firstline[j-1] == "." and firstline[j-len(start)+1] == "*"): nextline.append("*") else: nextline.append(".") firstline = "".join(nextline) print firstline nextline = []
304
« on: September 03, 2011, 04:43:44 AM »
Forbidding the use of certain functions, certain data types, etc...
Our instructor pisses us off that way. >.<
No restrictions as far as I know btw, I has started a sortve code, that sortve works... lines = int(raw_input("Number of lines: ")) start = raw_input("Start line: ") firstline = start nextline = [] print firstline for i in range(lines-1): for j in range(len(start)-1): if (firstline[j-1] == "*" and firstline[j+1] == "."): nextline.append("*") elif (firstline[j-1] == "." and firstline[j+1] == "*"): nextline.append("*") else: nextline.append(".") firstline = "".join(nextline) print firstline nextline = []
It starts off good, going: Number of lines: 8 Start line: ......*...... ......*...... .....*.*.... but then: Traceback (most recent call last): File "C:/Users/User/Documents/testingagain.py", line 10, in <module> elif (firstline[j-1] == "." and firstline[j+1] == "*"): IndexError: string index out of range
305
« on: September 03, 2011, 03:53:21 AM »
Your best bet is to make a flowchart. This is what I usually do when I'm trying to solve complex but recursive problems.
Also, are there any restrictions to your program?
I have tried that, i know the general idea of how to do it, I just don't know how to get python to do it Restrictions? by what do you mean?
306
« on: September 03, 2011, 03:33:32 AM »
Anyone here good with python? (outside of Ra2) I got this problem with this challenge: Imagine you have a sheet of grid paper with the left and right sides joined together to make a cylinder. Each square on the grid is either a period . or a star *. Starting with some pattern in the top row of the grid, we determine the next row by applying a simple rule: - for each position in the grid:
- put a star in the grid if there is a star either to the left or the right in the row above, but not both.
- otherwise put a period.
There are eight different possible configurations of the left, middle and right cell in the top row. The eight patterns are shown below with the corresponding middle cell in the new row. We have put vertical lines in for clarity, your program should not put these in: |*|*|*| |*|*|.| |*|.|*| |*|.|.| |.| |*| |.| |*| |.|*|*| |.|*|.| |.|.|*| |.|.|.| |*| |.| |*| |.| Again, just to be clear, we only print a * in the middle cell in the row below when there is a * in either the left or the right cell in the row above, but not both. This is a 1-dimensional cellular automaton. Cellular automata are very simple computational systems inspired by biology. The state of each cell is either on (a star in our example) or off (a period), and the state of each cell in the future is governed by simple rules about the current state of the cell and its neighbours. In our 1-dimensional automata, the future is the next row of output. Your program will simulate the cellular automata described above. It should read a number and a string from raw_input. The number will indicate the number of rows to generate, and the string is the starting row. It should then print out the first row and all subsequent rows until the number of rows printed is the number of rows that were requested (the number from raw_input). For example: Number of lines: 8 Start line: ........*......... ........*......... .......*.*........ ......*...*....... .....*.*.*.*...... ....*.......*..... ...*.*.....*.*.... ..*...*...*...*... .*.*.*.*.*.*.*.*.. This type of machine is called a cellular automata because it is inspired by the way bacterial cells grow. Perhaps the most famous of these is the two dimensional version called Conway's Game of Life. Don't really want the solution, just want some help on to how to go about solving this. Did try the forum on the challenge website, but I have yet to recieve and answer :/ Also, im using python 2.6.5 in idle
307
« on: September 02, 2011, 01:52:38 AM »
07-audiotrack 7 (in case people are wondering, its from age of empires sound track)
308
« on: September 02, 2011, 01:37:59 AM »
Why, is it always the flippers?  Nice match bubble
309
« on: September 01, 2011, 03:12:32 AM »
AHhh, loved Thing Thing Arena 3. Dual welding shot guns I believe i used to use all the time
310
« on: August 30, 2011, 06:22:39 AM »
5. Maplestory (i just love it)
Used to waste sooooo much time playing that game xD Shame that the new patches have made it so much easier to level. I liked it when you were strong if you were level 70.
Ahh, the good old days, where I could never get past lvl 40 before getting bored of that char and changing XD Though, I do love my lvl 134 Mechanic. Even though i havnt played it in a while :P
311
« on: August 29, 2011, 03:11:41 AM »
What is love? Haddaway
312
« on: August 29, 2011, 03:03:17 AM »
^will agree with robo on that one^
1. Doom series (will always be that) 2. Amnesia: The Dark Descent (never gets old) 3. Aion (damn you deadtarget :P) 4. WoW (one again, damn you deadtarget) 5. Maplestory (i just love it) 6. Left for Dead 1-2 (Once again, never gets old) 7. Hmmm, whatever i feel like :P (was inclined to say Minecraft or Dwarf Fortress, but can't make my mind up)
313
« on: August 28, 2011, 06:02:55 AM »
Bakugan. Didn't think I would like it
Wow. Didn't really think highly of it, so i'd never thought I would like it :P (mind you, I love both Titan quest and Sacred 2)
314
« on: August 28, 2011, 04:44:35 AM »
Hmm, so I was thinking about getting back into RA2.. Then XxDeadtarget told me to go get Aion.
There goes that idea out the window :P
lol I had the same thought.. until I brought a PS3 :P
Hahahaha XD I should get a ps3 as well :P BUT, in the mean time, Xxdeadtarget has me playing both WoW and Aion, so yeah :P
315
« on: August 28, 2011, 04:34:49 AM »
I now tell you to go get Deus Ex.
I so actually wanna get that
316
« on: August 28, 2011, 04:04:00 AM »
Hmm, so I was thinking about getting back into RA2.. Then XxDeadtarget told me to go get Aion.
There goes that idea out the window :P
317
« on: August 28, 2011, 04:02:06 AM »
I like you and your friend's accents.
Haha thanks XD Can you guess which voice is mine?
318
« on: August 27, 2011, 07:31:15 AM »
and now I am digging up old fossils from le BoTM files apparently *pic* Was gonna be for Stocks Revenge, but then they added the goddamn REALISTIC RULE. So I entered it in BoTM. Still dunno how GK guessed it was me WHEN I
Haha sorry about that XD Hint: It may come back Stocks Revenge though dsl style :D
319
« on: August 27, 2011, 07:25:30 AM »
Yeah im pretty sure its them :D
320
« on: August 27, 2011, 07:10:58 AM »
Ohhh theres octus in that picture :D
Pages: 1 ... 9 10 11 12 13 14 15 [16] 17 18 19 20 21 22 23 ... 115
|