代写CS253 HW7程序、代做C++程序、data留学生编程代写代写留学生Prolog|帮做SPSS

CS253 HW7: Life in Jail
Changes
Updates to the assignment will be noted here. None yet!
Description
HW7 has all the same requirements & restrictions as HW6, with the addition
of a single method.
Methods
Rule must have the following additional public method:
.jail(string jail-program)
If this method is called, then instead of using Conway’s rule from HW2, or a Golly rule from HW4,
use the jail-program to evaluate whether or not a cell lives or dies when .eval() is called.
The Jail program will expect nine arguments, which will be placed in the variables A…I, that indicate
the immediate neighboorhood of the cell in question, including the cell itself. Each argument will be
0 if the cell is dead, and 1 if the cell is alive. The program must return 0 if the cell should be dead in
the next generation, and 1 if it should be alive.
The nine arguments represent the adjacent cells and the cell itself, and correspond to the nine
arguments to Rule::eval(), like this:
nw n ne
w me e
sw s se
or
A B C
D E F
G H I
That is, E is the cell in question. D is its neighbor to the left, H is its neighbor below, and so on.
If there are any bad tokens in the Jail program, throw a runtime_error when Rule::jail() is
called. As in HW5, other errors (mismatched if/fi, if a b <, etc.) must result in a thrown
runtime_error, either when Rule::jail() is called, or when the program is actually executed
via Rule::eval().
The Jail program is not executed when Rule::jail() is called. Rule::jail() performs lexical
analysis on the Jail program, and remembers it. Later, when Rule::eval() is called, the Jail
program is executed (interpreted). Of course, for any Board, computing the next generation will
require calling Rule::eval() many times, once for each cell.
It is valid to call Rule::conway(), Rule::golly(), or Rule::jail() in any combination,
several times. The last call determines the future behavior of Rule::eval().
Sample Run
Here is a sample run,
where % is my shell
prompt:
2020/11/29 CS253 | Main / HW7
https://cs.colostate.edu/~cs253/Fall20/HW7 2/3
% cmake .
r.jail(R"(# Conway’s rule in JAIL
# A B C
# D E F
# G H I
# Accumulate count in C:
c += a c += b c += d c += f
c += g c += h c += i
if C = 2 return E fi # Two neighbors means survive
if C = 3 return 1 fi # Three neighbors mean born or survive
return 0 # Death otherwise
)");
Board b("blinker", r);
cout << b << '\n';
for (int i=0; i<3; i++)
cout << ++b << '\n';
r.jail("return a # move down to the right");
Board b3("block3", '*', '\'', r);
cout << b3 << '\n';
for (int i=0; i<3; i++)
cout << ++b3 << '\n';
}
Tar le
The tar le
for this assignment must be called: hw7.tar
It must contain:
source les
(*.cc), including Board.cc & Rule.cc
header les
(*.h), including Board.h & Rule.h
CMakeLists.txt, which will create the library le
libhw7.a.
These commands must produce the library libhw7.a:
cmake . && make
Your CMakeLists.txt must use at least -Wall when compiling.
How to submit your work:
In Canvas, check in the le
hw7.tar to the assignment “HW7”.
How to receive negative points:
Turn in someone else’s work.

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图