i am trying to use turing make a hangman game,
who have any idae or a simple code??
Archived topic from Iceteks, old topic ID:3283, old post ID:26590
who can help with my hangman game??
-
- Posts: 34
- Joined: Thu May 05, 2005 9:05 pm
who can help with my hangman game??
i actually just created one of them like last year, give me a few to re-download all them files from briefcase and i will throw in some lil tidbits for the code
Archived topic from Iceteks, old topic ID:3283, old post ID:26647
Archived topic from Iceteks, old topic ID:3283, old post ID:26647
-
- Posts: 34
- Joined: Thu May 05, 2005 9:05 pm
who can help with my hangman game??
ok this is the hangman form:
setscreen ("graphics:600;600")
drawoval (maxx - 300, maxy - 250, 50, 50, 12)
drawline (maxx - 300, (maxy - 300), maxx - 300, maxy - 450, 12)
drawline (maxx - 300, maxy - 450, maxx - 250, maxy - 550, 12)
drawline (maxx - 300, maxy - 450, maxx - 350, maxy - 550, 12)
drawline (maxx - 300, maxy - 375, maxx - 375, maxy - 300, 12)
drawline (maxx - 300, maxy - 375, maxx - 225, maxy - 300, 12)
drawline (maxx - 5, 5, maxx - 5, maxy - 120, 12) %creates hangman
drawline (maxx - 5, maxy - 120, maxx - 300, maxy - 120, 12) %creates hangman
drawline (maxx - 300, maxy - 120, maxx - 300, maxy - 200, 12) %creates hangman
i would also suggest using array's for guess the words something like:
to place the words into while guess or else u will get the problems that i had with mine if u would like i will post all of my code
Archived topic from Iceteks, old topic ID:3283, old post ID:26698
setscreen ("graphics:600;600")
drawoval (maxx - 300, maxy - 250, 50, 50, 12)
drawline (maxx - 300, (maxy - 300), maxx - 300, maxy - 450, 12)
drawline (maxx - 300, maxy - 450, maxx - 250, maxy - 550, 12)
drawline (maxx - 300, maxy - 450, maxx - 350, maxy - 550, 12)
drawline (maxx - 300, maxy - 375, maxx - 375, maxy - 300, 12)
drawline (maxx - 300, maxy - 375, maxx - 225, maxy - 300, 12)
drawline (maxx - 5, 5, maxx - 5, maxy - 120, 12) %creates hangman
drawline (maxx - 5, maxy - 120, maxx - 300, maxy - 120, 12) %creates hangman
drawline (maxx - 300, maxy - 120, maxx - 300, maxy - 200, 12) %creates hangman
i would also suggest using array's for guess the words something like:
to place the words into while guess or else u will get the problems that i had with mine if u would like i will post all of my code
Archived topic from Iceteks, old topic ID:3283, old post ID:26698
who can help with my hangman game??
Since I came to this forum, I'm working on one right now. The GUI version isn't working correctly... I dunno what the problem is, and I may work on it later, but not right now... Here's the GUI version...
Code: Select all
import GUI
%var picID:array 1..5 of int
var a1,a2,a3,a4:string:="ZEND"
var picID1,picID2,picID3,picID4,picID5,Butt_Sub,count,wrong:int
var Butt_exit,q1,q2,q3,q4,fontID,t1:int
wrong:=0
count:=1
fontID:=Font.New("Times New Roman:12x6")
procedure submit
if a1="ZEND"
then
end if
if a1 not="ZEND"
then
if a1="QWERTY" or a1="qwerty" or a1="Qwerty"
then
count:=2
else
wrong+=1
end if
end if
if a2 not="ZEND"
then
if a2="QWERTY" or a2="qwerty" or a2="Qwerty"
then
count:=3
else
wrong+=1
end if
end if
if a3 not="ZEND"
then
if a3="QWERTY" or a3="qwerty" or a3="Qwerty"
then
count:=4
else
wrong+=1
end if
end if
if a4 not="ZEND"
then
if a4="QWERTY" or a4="qwerty" or a4="Qwerty"
then
count:=5
else
wrong+=1
end if
end if
end submit
procedure t2(text:string)
if a1="ZEND"
then
a1:=text
elsif a1 not="ZEND" and a2="ZEND"
then
a2:=text
elsif a2 not="ZEND" and a3="ZEND"
then
a3:=text
elsif a3 not="ZEND" and a4="ZEND"
then
a4:=text
end if
end t2
procedure exitq
GUI.Quit
end exitq
procedure NoHang
Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
end NoHang
procedure HeadHang
Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
end HeadHang
procedure TorsoHang
Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
end TorsoHang
procedure LegRightHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
end LegRightHang
procedure LegLeftHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
end LegLeftHang
View.Set("nobuttonbar,title:Hangman")
GUI.SetBackgroundColour(gray)
% Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
% Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
% Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
% Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
if wrong=0
then
NoHang
put"0 Wrong"
end if
if wrong=1
then
HeadHang
put"1 Wrong"
end if
if wrong=2
then
TorsoHang
put"2 Wrong"
end if
if wrong=3
then
LegRightHang
put "3 Wrong"
end if
if wrong=4
then
LegLeftHang
put"All Wrong"
end if
if count=1
then
q1:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=2
then
q2:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=3
then
q3:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=4
then
q4:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
end if
t1:=GUI.CreateTextFieldFull(200,maxy div 2-150,200,"",t2,GUI.INDENT,fontID,0)
Butt_Sub:=GUI.CreateButtonFull(200,maxy div 2-180,0,"Submit",submit,0,"S",true)
%exit when wrong<5 and count=5
Butt_exit:=GUI.CreateButtonFull(maxx-50,0,0,"Exit",exitq,0,"E",false)
loop
exit when GUI.ProcessEvent
end loop
[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:3283, old post ID:26968[/size][/color]
who can help with my hangman game??
And, since it looks like I can't edit my own post, I'll post what I was able to get done of the other Hangman game (non GUI.)
Code: Select all
const a1:="QWERTY"
const a2:="QWERTY"
const a3:="QWERTY"
const a4:="QWERTY"
const q1:="What is a common type of keyboard? (Q__R_Y)"
const q2:="What is a common type of keyboard? (Q__R_Y)"
const q3:="What is a common type of keyboard? (Q__R_Y)"
const q4:="What is a common type of keyboard? (Q__R_Y)"
var count,right,wrong:int
var UserAnswer1,UserAnswer2,UserAnswer3,UserAnswer4:string:=""
wrong:=0
right:=0
count:=1
procedure NoHang
Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
end NoHang
procedure HeadHang
Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
end HeadHang
procedure TorsoHang
Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
end TorsoHang
procedure LegRightHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
end LegRightHang
procedure LegLeftHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
end LegLeftHang
View.Set("nobuttonbar,title:Hangman,nocursor")
% Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
% Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
% Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
% Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
loop
exit when count=5
if wrong=0
then
NoHang
elsif wrong=1
then
HeadHang
elsif wrong=2
then
TorsoHang
elsif wrong=3
then
LegRightHang
elsif wrong=4
then
LegLeftHang
end if
if count=1
then
locate(1,1)
put q1
count+=1
get UserAnswer1
Draw.FillBox(0,maxy-40,maxx,maxy-20,0)
elsif count=2
then
locate(1,1)
put q2
get UserAnswer2
count+=1
Draw.FillBox(0,maxy-40,maxx,maxy-20,0)
elsif count=3
then
locate(1,1)
put q3
get UserAnswer3
count+=1
Draw.FillBox(0,maxy-40,maxx,maxy-20,0)
elsif count=4
then
locate(1,1)
put q4
get UserAnswer4
count+=1
Draw.FillBox(0,maxy-40,maxx,maxy-20,0)
end if
Draw.FillBox(0,maxy-40,maxx,maxy-20,0)
if UserAnswer1=a1
then
right+=1
else
wrong+=1
end if
if UserAnswer2=a2
then
right+=1
else
wrong+=1
end if
if UserAnswer3=a3
then
right+=1
else
wrong+=1
end if
if UserAnswer4=a4
then
right+=1
else
wrong+=1
end if
end loop
cls
if right=1
then
put"Congradulations, you got one point."
elsif right=2
then
put"Congradulations, you got two points."
elsif right=3
then
put"Congradulations, you got three points."
elsif right=4
then
put"Congradulations on beating the game."
else
put"You didn't beat the game. Better luck next time."
end if
[code]
Enjoy.
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:3283, old post ID:26975[/size][/color]