首页 > > 详细

讲解留学生Consensus Programming Project 语言、R辅导、辅导留学生R设计、R讲解、调试R、R程序讲解

Introduction
In this assignment youwill continuetohoneyour distributedsystems development skills. Youwill
implement a distributed consensus protocol and use it as a building block for a distributed application.
Assignment
Your task is to implement the​Raft distributedconsensus protocol andthenuseit toimplement a
distributedversionof​Rock ‘EmSock ‘Emrobots​. Notethat althoughtherearemanyRaft implementation
available on the internet, you will need to implement yours fromscratch - undue similarity to publicly
available code will be seen as plagiarism.
Rock ‘Em Sock ‘Em Robots
From Wikipedia we learn: “Rock 'Em Sock 'EmRobots is a two-player action toy and game. It
features two dueling robot boxers, Red Rocker and Blue Bomber, mechanically manipulated by the
players, and the game is won when one player knocks the head off of the opponent.” You canseea
lifesize version the game in action ​here​!
Your distributed program should allow human players on two different computers as either Red
Rocker and BlueBomber. Eachrobot canbedirectedtoperformthefollowingactions (slightly modified
from the original game):
● punch_with_left()​ [Q]
● punch_with_right()​ [W]
● block_with_left()​ [A]
● block_with_right()​ [S]
When a robot blocks, it enters a​blocking_with_left​, or ​blocking_with_right state, which
persists until another actionis taken. When​blocking_with_leftopponent’s puncheswiththeright are
blocked. Analogously for ​blocking_with_right​, punches with opponent’s left are blocked.
Whenpunchinganopponent whois not blocking, arobot has 10%chanceof landingahit. If ahit
lands, the opponent’s head is knocked off and the the match is over. A robot can only punch oncea
second. After being blocked, a robot cannot punch for three seconds with either hand.
One of your tasks will be to define a user interface that lets a user take actions and receive
feedback as toits effect. Becauseyour systemincludes twoplayers, youmay needtowritescripts that
trigger their actions.
Raft
You will host your gameonusingtwoclients andfiveservers. Wewill assumethat clients donot
fail, but theservers andcommunicationbetweenthemcan. Theroleof theservers is tomaintaingame
state and arbiter the order of player actions.
The five servers will run the Raft consensus protocol to maintain between them log of player
actions. To implement the game, the servers will also need to use this log to maintain game state,
specifically whether a player is currently blockingandwhether they areallowedyet todispatchanother
punch.
In addition to normal Raft operation, your servers need support the following operations:
● fail()​ - the server ‘crashes’ and loses all local state
● recover()​ - the server ‘recovers,’ rejoins the Raft protocol, and recovers the log and state
● timeout()​ - the server decides that it has not heard from the coordinator within a timeout
You will use these operation to demonstrate the robustness of your Raft implementation.
Deployment
Youmust implement asystemwithfiveservernodes. Eachnodewill berunonadifferent machine.
Thelogshouldbewrittentopermanent storage, sothat it will survivenodecrashes. Youneedtoprovide,
at least, aminimal user interface(UI) for players totakeactions. Atext-basedUI isfine. Thecontentsof
the log must also be viewable, for example by reading a file, so long as the file is human readable.
You will deploy your project on Amazon EC2, on fivemachines indifferent regions. Youwill use
micro-instances. Youshouldsignupfor AWSEducatetoget your $35credit for useof Amazon’s cloud
infrastructure. This should be enough for you to deploy and demo theproject. Youshouldnot doyour
development inAWS, but pushyourcodefromarepository(GitHub, BitBucket)toyourAWSinstancesto
test and demo. Please be careful to use a private repository, or otherwiseprotect privatekeys sothat
your AWS accounts are not hacked.
Grading
Your gradewill bebasedonascreencast that demonstratesthefunctionalityof yourcode. I expect
the demonstration to show the different types of events that players may take. You also need to
demonstratethecorrect operationof yourRaft implementationthroughservercrashesandtimeouts. I will
be looking for functionality and correctness of your mechanisms.
What to submit?
1. A link to a YouTube video showing your code running on AWS instances.
2. Your source code (unzipped) for D2L plagiarism check
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!