Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OBJECT Grid2D
- rnum
- cnum
- grid
- pgrid
- border
- activate _Grid2D_3cd_activate
- simulate _Grid2D_3cd_simulate
- fetch _Grid2D_3cd_fetch
- plan _Grid2D_3cd_plan
- init _Grid2D_3cd_init
- getNeighbors _Grid2D_3cd_getNeighbors
- act _Grid2D_3cd_act
- output _Grid2D_3cd_output
- END
- @DEPENDS console.nx
- METHOD _Grid2D_3cd_init rnum cnum
- fetch rnum
- object_self
- object_fetch rnum
- set
- fetch cnum
- object_self
- object_fetch cnum
- set
- fetch rnum
- aalocate
- object_self
- object_fetch grid
- set
- iconst_0
- istore i
- b1:
- fetch rnum
- fetch i
- lesser
- branchif b2
- branch b3
- b2:
- fetch cnum
- aalocate
- object_self
- object_fetch grid
- fetch i
- afetch
- set
- iconst_1
- fetch i
- add
- istore i
- branch b1
- b3:
- fetch rnum
- aalocate
- object_self
- object_fetch pgrid
- set
- iconst_0
- istore i
- b4:
- fetch rnum
- fetch i
- lesser
- branchif b5
- branch b6
- b5:
- fetch cnum
- aalocate
- object_self
- object_fetch pgrid
- fetch i
- afetch
- set
- iconst_1
- fetch i
- add
- istore i
- branch b4
- b6:
- ascii_literal
- istore border
- iconst_0
- istore i
- b7:
- fetch cnum
- fetch i
- lesser
- branchif b8
- branch b9
- b8:
- ascii_literal -
- fetch border
- concat
- istore border
- iconst_1
- fetch i
- add
- istore i
- branch b7
- b9:
- ascii_literal \n
- fetch border
- concat
- object_self
- object_fetch border
- set
- END
- METHOD _Grid2D_3cd_output
- object_self
- object_fetch border
- invoke con_printstr
- iconst_0
- istore i
- b1:
- object_self
- object_fetch rnum
- fetch i
- lesser
- branchif b2
- branch b3
- b2:
- ascii_literal |
- invoke con_printstr
- iconst_0
- istore j
- b4:
- object_self
- object_fetch cnum
- fetch j
- lesser
- branchif b5
- branch b6
- b5:
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- branchif b7
- ascii_literal
- invoke con_printstr
- branch b8
- b7:
- ascii_literal O
- invoke con_printstr
- b8:
- iconst_1
- fetch j
- add
- istore j
- branch b4
- b6:
- ascii_literal |\n
- invoke con_printstr
- iconst_1
- fetch i
- add
- istore i
- branch b1
- b3:
- object_self
- object_fetch border
- invoke con_printstr
- END
- METHOD _Grid2D_3cd_fetch r c
- object_self
- object_fetch rnum
- fetch r
- object_self
- object_fetch rnum
- add
- modulo
- istore r
- object_self
- object_fetch cnum
- fetch c
- object_self
- object_fetch cnum
- add
- modulo
- istore c
- object_self
- object_fetch grid
- fetch r
- afetch
- fetch c
- afetch
- return_ref
- END
- METHOD _Grid2D_3cd_plan
- iconst_0
- istore i
- b1:
- object_self
- object_fetch rnum
- fetch i
- lesser
- branchif b2
- branch b3
- b2:
- iconst_0
- istore j
- b4:
- object_self
- object_fetch cnum
- fetch j
- lesser
- branchif b5
- branch b6
- b5:
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- istore me
- fetch j
- fetch i
- object_self
- object_call getNeighbors
- istore neighbors
- fetch me
- branchif b7
- iconst_3
- fetch neighbors
- eql
- branchif b9
- branch b10
- b9:
- iconst -1
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- set
- b10:
- branch b8
- b7:
- iconst_3
- fetch neighbors
- greater
- iconst_2
- fetch neighbors
- lesser
- or
- branchif b11
- branch b12
- b11:
- iconst_2
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- set
- b12:
- b8:
- iconst_1
- fetch j
- add
- istore j
- branch b4
- b6:
- iconst_1
- fetch i
- add
- istore i
- branch b1
- b3:
- END
- METHOD _Grid2D_3cd_act
- iconst_0
- istore i
- b1:
- object_self
- object_fetch rnum
- fetch i
- lesser
- branchif b2
- branch b3
- b2:
- iconst_0
- istore j
- b4:
- object_self
- object_fetch cnum
- fetch j
- lesser
- branchif b5
- branch b6
- b5:
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- istore me
- iconst_2
- fetch me
- eql
- branchif b7
- branch b8
- b7:
- iconst_0
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- set
- b8:
- iconst -1
- fetch me
- eql
- branchif b9
- branch b10
- b9:
- iconst_1
- object_self
- object_fetch grid
- fetch i
- afetch
- fetch j
- afetch
- set
- b10:
- iconst_1
- fetch j
- add
- istore j
- branch b4
- b6:
- iconst_1
- fetch i
- add
- istore i
- branch b1
- b3:
- END
- METHOD _Grid2D_3cd_getNeighbors r c
- iconst_0
- istore friendcount
- iconst -1
- istore i
- b1:
- iconst_1
- fetch i
- lesser_eql
- branchif b2
- branch b3
- b2:
- iconst -1
- istore j
- b4:
- iconst_1
- fetch j
- lesser_eql
- branchif b5
- branch b6
- b5:
- fetch j
- fetch c
- add
- fetch i
- fetch r
- add
- object_self
- object_call fetch
- branchif b7
- branch b8
- b7:
- iconst_0
- fetch j
- eql
- iconst_0
- fetch i
- eql
- and
- not
- branchif b9
- branch b10
- b9:
- iconst_1
- fetch friendcount
- add
- istore friendcount
- b10:
- b8:
- iconst_1
- fetch j
- add
- istore j
- branch b4
- b6:
- iconst_1
- fetch i
- add
- istore i
- branch b1
- b3:
- fetch friendcount
- return_x
- END
- METHOD _Grid2D_3cd_simulate
- b1:
- iconst_1
- branchif b2
- branch b3
- b2:
- object_self
- object_call output
- object_self
- object_call plan
- object_self
- object_call act
- branch b1
- b3:
- END
- METHOD _Grid2D_3cd_activate r c
- iconst_1
- fetch c
- fetch r
- object_self
- object_call fetch
- set
- END
- METHOD main
- iconst 130
- iconst 50
- object_instantiate Grid2D
- istore g
- iconst 10
- iconst 10
- fetch g
- object_call activate
- iconst 10
- iconst 12
- fetch g
- object_call activate
- iconst 13
- iconst 13
- fetch g
- object_call activate
- iconst 11
- iconst 10
- fetch g
- object_call activate
- iconst 12
- iconst 10
- fetch g
- object_call activate
- iconst 11
- iconst 11
- fetch g
- object_call activate
- iconst 13
- iconst 11
- fetch g
- object_call activate
- iconst 13
- iconst 12
- fetch g
- object_call activate
- fetch g
- object_call simulate
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement