便士推销任何人? [英] penny pitch anyone?

查看:136
本文介绍了便士推销任何人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力做一分钱的投球比赛。总和在游戏结束时返回,玩家有2个选项:折腾和退出。当点击折腾选项时,程序执行此操作:从第n行n列抛出生成两个随机数,在此位置将数字添加到运行总计中,并显示用P'替换数字的板,其中有便士落地。 />

这是董事会的样子


1 1 1 1 1 1

1 2 2 2 2 2 1

1 2 3 3 3 2 1

1 2 3 5 3 2 1

1 2 3 3 3 2 1

1 2 2 2 2 2 1

1 1 1 1 1 1


董事会职位从[1,1]开始编入索引在左上角,不是[0,0],因此行n列从1到7.


i在c ++中成功编程了这个,但是在java中无法这样做...阵列不是我的事情


如果有人可以提供帮助,那就太好了,谢谢。

i am trying to make a penny pitch game. the sum is returned at the end of the game and the player has 2 options: toss and quit. the program does this when the toss option is clicked: generates two random numbers from teh row n column toss, add number at this position to the running total, and displays the board replacing the numbers with P''s where pennies land.

here is what the board looks like

1 1 1 1 1 1 1
1 2 2 2 2 2 1
1 2 3 3 3 2 1
1 2 3 5 3 2 1
1 2 3 3 3 2 1
1 2 2 2 2 2 1
1 1 1 1 1 1 1

the boards position are indexed starting at [1,1] in the top left, not [0,0], thus the rows n columns go from 1 to 7.

i have succcessfully programed this in c++, but am unable to do so in java...arrays are just not my thing

if anyone can assist, that would be great, thanks.

推荐答案

你究竟需要什么帮助?



你到底需要什么帮助?
What exactly do you need help with?



i基本上需要帮助入门,比如设置阵列/游戏板......我几乎可以照顾其余部分

i basically need help getting started, like setting up the array/game board...i can pretty much take care of the rest


嗯,这取决于游戏板究竟需要什么。它是2D整数数组吗?它是对象吗?


基本语法是:


< Typename> board = new< Typename> [< xSize>] [< ySize>];


然后你可以像在C ++中那样填充它。
Well, that depends on what exactly needs to be in the game board. Will it be a 2D integer array? Will it be objects?

The basic syntax will be:

<Typename> board = new <Typename>[<xSize>][<ySize>];

and then you can fill it like you would in C++.


这篇关于便士推销任何人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆