This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------ | |
#in else block | |
try: | |
obj = db.create_obj(): | |
except DBExploded as e: | |
pass | |
else: | |
#obj is guarenteed to be valid object | |
obj.do_something() | |
obj.save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collapse(lst): | |
def chunk(lst): | |
ret = [lst[0],] | |
for i in lst[1:]: | |
if ord(i) == ord(ret[-1]) + 1: | |
pass | |
else: | |
yield ret | |
ret = [] | |
ret.append(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func modify (myarr *[]int) { | |
myarr = append(*myarr, 4) | |
} | |
func main() { | |
arr := []int{} | |
arr = append(arr, 1) | |
arr = append(arr, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALLFF << @SELFDESTRUCT 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Monitor> lc | |
CID PID ARGV | |
1 5615 ['gridstream/server.py'] | |
<Monitor> sc 1 | |
Remote connection 1. To return to Monitor, type <Ctrl-C> or .<RETURN> | |
<Annex> int | |
Remote interactive console. To return to Annex, type '-'. | |
>>> hp.heap() | |
Partition of a set of 283455 objects. Total size = 134611440 bytes. | |
Index Count % Size % Cumulative % Kind (class / dict of class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@LOOPSTART | |
# look around for resources | |
CALLFF << @LOOK @NORTH 2 | |
EQUAL << @CELL_RESOURCE | |
IFTGOTO << @PULLNORTH | |
CALLFF << @LOOK @EAST 2 | |
EQUAL << @CELL_RESOURCE | |
IFTGOTO << @PULLEAST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@LOOPSTART | |
# just charge | |
CALLFF << @INSPECT @HERE @CHARGE 3 | |
LESS << 50 | |
IFTGOTO << @CHARGEME | |
# scan around | |
CALLFF << @SCAN -4 0 3 | |
EQUAL << @CELL_ROBOT | |
CALLFF << @SCAN -3 0 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This bot will continually travel south | |
# pulling from all directions. if it encounters | |
# any obstacles, it'll move out of the way | |
@LOOPSTART | |
# look around for resources | |
CALLFF << @LOOK @NORTH 2 | |
EQUAL << @CELL_RESOURCE | |
IFTGOTO << @PULLNORTH | |
CALLFF << @LOOK @EAST 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUSH 0 | |
PUSH 0 | |
PUSH 0 | |
PANIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This bot will continually travel south | |
# pulling from the east or west if it | |
# finds resources there | |
@LOOPSTART | |
CALLFF << @SCAN 1 0 3 | |
testtgoto << @PULLEAST | |
FFI << @LOOK @WEST | |
testtgoto << @PULLWEST | |
FFI << @MOVE @SOUTH |