#include <stdio.h>
struct Dice
{
int up, down, north, east, south, west;
};
struct Dice d;
int main()
{
int n, i;
char str[10];
while (scanf("%d", &n) == 1 && n)
{
d.up = 1, d.down = 6, d.north = 2,
d.east = 4, d.south = 5, d.west = 3;
while (n --)
{
scanf("%s", str);
if (str[0] == 's') /* 南 */
d.south = d.up, d.up = d.north,
d.down = 7 - d.up, d.north = 7 - d.south;
if (str[0] == 'n') /* 北 */
d.down = d.north, d.north = d.up,
d.up = 7 - d.down, d.south = 7 - d.north;
if (str[0] == 'w')
d.down = d.west, d.west = d.up,
d.up = 7 - d.down, d.east = 7 - d.west;
if (str[0] == 'e')
d.east = d.up, d.up = d.west,
d.down = 7 - d.up, d.west = 7 - d.east;
}
printf("%d\n", d.up);
}
return 0;
}
回目錄
回首頁
沒有留言 :
張貼留言